aicx 0.9.2

Operator CLI + MCP server: canonical corpus first, optional semantic index second (Claude Code, Codex, Gemini)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
name: Release

on:
  push:
    tags:
      - "v*"
  workflow_dispatch:
    inputs:
      tag:
        description: "Release tag to build (vX.Y.Z)"
        required: true
        type: string

permissions:
  contents: write

env:
  CARGO_TERM_COLOR: always
  PACKAGE_NAME: aicx
  RUST_MEMEX_REF: 047e63bd9c89bb174fed6e69f9a3a9c203e04981

jobs:
  verify:
    name: Verify release input
    runs-on: [self-hosted, ops-linux]
    outputs:
      release_tag: ${{ steps.meta.outputs.release_tag }}
      version: ${{ steps.meta.outputs.version }}

    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0
          path: aicx

      - name: Checkout rust-memex sibling
        uses: actions/checkout@v6
        with:
          repository: Loctree/rust-memex
          ref: ${{ env.RUST_MEMEX_REF }}
          path: rust-memex

      - name: Install protoc
        # Manual install — see ci.yml for rationale (arduino/setup-protoc#108).
        shell: bash
        run: |
          if command -v protoc >/dev/null 2>&1; then
            echo "protoc already installed: $(protoc --version)"
            exit 0
          fi
          if [[ "$RUNNER_OS" == "Linux" ]]; then
            sudo apt-get update -qq
            sudo apt-get install -y -qq protobuf-compiler
          elif [[ "$RUNNER_OS" == "macOS" ]]; then
            brew install protobuf
          else
            echo "::error::Unsupported OS for protoc install: $RUNNER_OS"
            exit 1
          fi
          protoc --version

      - name: Resolve release tag
        id: meta
        env:
          EVENT_NAME: ${{ github.event_name }}
          INPUT_TAG: ${{ inputs.tag }}
          REF_NAME: ${{ github.ref_name }}
        run: |
          release_tag="${REF_NAME}"
          if [[ "${EVENT_NAME}" == "workflow_dispatch" ]]; then
            release_tag="${INPUT_TAG}"
          fi
          if [[ -z "${release_tag}" ]]; then
            echo "release tag is required" >&2
            exit 1
          fi
          if [[ ! "${release_tag}" =~ ^v[0-9]+[.][0-9]+[.][0-9]+ ]]; then
            echo "release tag must look like vX.Y.Z" >&2
            exit 1
          fi
          echo "release_tag=${release_tag}" >> "${GITHUB_OUTPUT}"
          echo "version=${release_tag#v}" >> "${GITHUB_OUTPUT}"

      - name: Check git tag exists
        working-directory: aicx
        env:
          RELEASE_TAG: ${{ steps.meta.outputs.release_tag }}
        run: git rev-parse --verify "refs/tags/${RELEASE_TAG}" >/dev/null

      - uses: actions/setup-python@v6
        with:
          python-version: '3.12'

      - name: Check release channel versions
        working-directory: aicx
        run: bash tools/release-channel-check.sh

      - name: Check Cargo.toml version matches tag
        working-directory: aicx
        env:
          RELEASE_VERSION: ${{ steps.meta.outputs.version }}
        run: |
          python - <<'PY'
          import os
          import sys
          import tomllib

          with open("Cargo.toml", "rb") as fh:
              cargo_version = tomllib.load(fh)["package"]["version"]

          release_version = os.environ["RELEASE_VERSION"]
          if cargo_version != release_version:
              print(
                  f"Cargo.toml version {cargo_version} does not match release tag v{release_version}",
                  file=sys.stderr,
              )
              raise SystemExit(1)
          PY

      - name: semgrep
        working-directory: aicx
        run: |
          python -m pip install --upgrade pip semgrep
          semgrep --config auto --error --quiet

      - uses: dtolnay/rust-toolchain@stable
        with:
          components: clippy, rustfmt

      - name: cargo clippy default
        working-directory: aicx
        run: cargo clippy --locked -p aicx --all-targets -- -D warnings

      - name: cargo clippy native GGUF
        working-directory: aicx
        run: |
          cargo clippy --locked -p aicx-embeddings --features gguf -- -D warnings
          cargo clippy --locked -p aicx --features native-embedder --all-targets -- -D warnings

      - name: cargo test --bin aicx
        working-directory: aicx
        run: cargo test --locked --bin aicx

      - name: cargo test --bin aicx-mcp
        working-directory: aicx
        run: cargo test --locked --bin aicx-mcp

      - name: cargo test native GGUF
        working-directory: aicx
        run: |
          cargo test --locked -p aicx-embeddings --features gguf
          cargo test --locked -p aicx --features native-embedder --test native_embedder

      - name: cargo fmt
        working-directory: aicx
        run: cargo fmt -- --check

      - name: Clean Cargo artifacts
        if: always()
        working-directory: aicx
        run: cargo clean

  build:
    name: Build ${{ matrix.target }} on ${{ matrix.runner_name }}
    needs: verify
    runs-on: ${{ fromJSON(matrix.runner) }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - runner_name: ops-linux
            runner: '["self-hosted", "ops-linux"]'
            target: x86_64-unknown-linux-gnu
          - runner_name: dragon-macos
            runner: '["self-hosted", "dragon-macos"]'
            target: aarch64-apple-darwin
          - runner_name: windows-pc
            runner: '["self-hosted", "windows-pc"]'
            target: x86_64-pc-windows-gnu

    steps:
      - uses: actions/checkout@v6
        with:
          path: aicx

      - name: Checkout rust-memex sibling
        uses: actions/checkout@v6
        with:
          repository: Loctree/rust-memex
          ref: ${{ env.RUST_MEMEX_REF }}
          path: rust-memex

      - name: Install protoc
        # Manual install — see ci.yml for rationale (arduino/setup-protoc#108).
        shell: bash
        run: |
          if command -v protoc >/dev/null 2>&1; then
            echo "protoc already installed: $(protoc --version)"
            exit 0
          fi
          if [[ "$RUNNER_OS" == "Linux" ]]; then
            sudo apt-get update -qq
            sudo apt-get install -y -qq protobuf-compiler
          elif [[ "$RUNNER_OS" == "macOS" ]]; then
            brew install protobuf
          else
            echo "::error::Unsupported OS for protoc install: $RUNNER_OS"
            exit 1
          fi
          protoc --version

      - uses: dtolnay/rust-toolchain@stable
        with:
          targets: ${{ matrix.target }}

      - name: Build signed + notarized macOS bundle (dragon-macos)
        if: matrix.runner_name == 'dragon-macos'
        shell: bash
        working-directory: aicx
        env:
          TARGET: ${{ matrix.target }}
          DIST_DIR: ${{ github.workspace }}/aicx/dist
          AICX_BUNDLE_FLAVOR: slim
          AICX_CLEAN_AFTER_BUILD: "0"
          PACKAGE_NAME: ${{ env.PACKAGE_NAME }}
          LOCTREE_GPG_KEY_ID: ${{ vars.LOCTREE_GPG_KEY_ID }}
        run: |
          # KEYS dir + .notary.env live on the dragon runner under $HOME/.keys.
          KEYS="$HOME/.keys" ./tools/release_bundle.sh

      - name: Build binaries-only release (ops-linux, GPG-detached)
        if: matrix.runner_name == 'ops-linux'
        shell: bash
        working-directory: aicx
        env:
          TARGET: ${{ matrix.target }}
          DIST_DIR: ${{ github.workspace }}/aicx/dist
          AICX_RELEASE_BUNDLE_ONLY_BINARIES: "1"
          AICX_BUNDLE_FLAVOR: slim
          AICX_CLEAN_AFTER_BUILD: "0"
          PACKAGE_NAME: ${{ env.PACKAGE_NAME }}
          LOCTREE_GPG_KEY_ID: ${{ vars.LOCTREE_GPG_KEY_ID }}
        run: |
          ./tools/release_bundle.sh

      - name: Build binaries-only release (windows-pc, GPG-detached .zip)
        if: matrix.runner_name == 'windows-pc'
        shell: bash
        working-directory: aicx
        env:
          TARGET: ${{ matrix.target }}
          DIST_DIR: ${{ github.workspace }}/aicx/dist
          AICX_RELEASE_BUNDLE_ONLY_BINARIES: "1"
          AICX_BUNDLE_FLAVOR: slim
          AICX_CLEAN_AFTER_BUILD: "0"
          PACKAGE_NAME: ${{ env.PACKAGE_NAME }}
          LOCTREE_GPG_KEY_ID: ${{ vars.LOCTREE_GPG_KEY_ID }}
          # Strawberry Perl ships mingw-w64 gcc — required for windows-gnu target.
          # Add it to PATH so cargo's linker finds it.
          PATH: "C:\\Strawberry\\c\\bin;C:\\Program Files (x86)\\GnuPG\\bin;C:\\Program Files\\Git\\usr\\bin;${{ env.PATH }}"
        run: |
          ./tools/release_bundle.sh

      - name: Build .deb (linux only)
        if: contains(matrix.target, 'linux')
        shell: bash
        working-directory: aicx
        env:
          TARGET: ${{ matrix.target }}
          DIST_DIR: ${{ github.workspace }}/aicx/dist
          LOCTREE_GPG_KEY_ID: ${{ vars.LOCTREE_GPG_KEY_ID }}
        run: |
          cargo install --quiet cargo-deb --locked || cargo install --quiet cargo-deb
          cargo deb --target "${TARGET}" --no-build --output "${DIST_DIR}/"
          PASSPHRASE_FILE="${HOME}/.keys/.gpg.passphrase"
          if [[ -z "${LOCTREE_GPG_KEY_ID}" ]]; then
            echo "::error::vars.LOCTREE_GPG_KEY_ID empty — refusing to publish unsigned .deb." >&2
            exit 1
          fi
          if [[ ! -r "${PASSPHRASE_FILE}" ]]; then
            echo "::error::Passphrase file ${PASSPHRASE_FILE} not readable on runner." >&2
            exit 1
          fi
          # Checksum and detached-sign every deb produced for this target.
          for deb in "${DIST_DIR}"/*.deb; do
            [ -f "${deb}" ] || continue
            ( cd "${DIST_DIR}" && shasum -a 256 "$(basename "${deb}")" ) > "${deb}.sha256"
            gpg --batch --yes --armor --pinentry-mode loopback \
              --passphrase-file "${PASSPHRASE_FILE}" \
              --sig-notation "apple-developer-team-id@loctree.io=MW223P3NPX" \
              --sig-notation "release-source@loctree.io=Loctree/aicx" \
              --detach-sign --local-user "${LOCTREE_GPG_KEY_ID}" \
              "${deb}"
          done

      - uses: actions/upload-artifact@v7
        with:
          name: release-${{ matrix.target }}
          # Selective: archives + checksums + sigs + debs only — exclude bundle
          # staging dirs that release_bundle.sh used to leave behind (those break
          # gh release upload with "is a directory").
          path: |
            aicx/dist/*.tar.gz
            aicx/dist/*.tar.gz.sha256
            aicx/dist/*.tar.gz.asc
            aicx/dist/*.zip
            aicx/dist/*.zip.sha256
            aicx/dist/*.zip.asc
            aicx/dist/*.notary.json
            aicx/dist/*.deb
            aicx/dist/*.deb.sha256
            aicx/dist/*.deb.asc
          if-no-files-found: error

      - name: Clean local build artifacts
        if: always()
        working-directory: aicx
        run: |
          cargo clean --target "${{ matrix.target }}" || true
          rm -rf dist

  github-release:
    name: Publish GitHub Release
    needs: [verify, build]
    runs-on: [self-hosted, ops-linux]

    steps:
      - uses: actions/checkout@v6
        with:
          fetch-depth: 0

      - uses: actions/download-artifact@v8
        with:
          path: dist
          pattern: release-*
          merge-multiple: true

      - uses: actions/setup-python@v6
        with:
          python-version: '3.12'

      - name: Generate release notes from CHANGELOG
        env:
          RELEASE_VERSION: ${{ needs.verify.outputs.version }}
          RELEASE_NOTES_PATH: ${{ runner.temp }}/release-notes.md
        run: |
          python3 tools/release_sync.py notes "${RELEASE_VERSION}" --output "${RELEASE_NOTES_PATH}"

      - name: GPG detached-sign release archives
        env:
          LOCTREE_GPG_KEY_ID: ${{ vars.LOCTREE_GPG_KEY_ID }}
        run: |
          if [[ -z "${LOCTREE_GPG_KEY_ID}" ]]; then
            echo "::error::vars.LOCTREE_GPG_KEY_ID is empty — refusing to publish unsigned release archives." >&2
            exit 1
          fi
          PASSPHRASE_FILE="${HOME}/.keys/.gpg.passphrase"
          if [[ ! -r "${PASSPHRASE_FILE}" ]]; then
            echo "::error::Passphrase file ${PASSPHRASE_FILE} not readable on runner." >&2
            exit 1
          fi
          if ! command -v gpg >/dev/null 2>&1; then
            echo "::error::gpg not available on runner — cannot sign release archives." >&2
            exit 1
          fi
          if ! gpg --list-secret-keys "${LOCTREE_GPG_KEY_ID}" >/dev/null 2>&1; then
            echo "::error::GPG secret key ${LOCTREE_GPG_KEY_ID} is not imported on this runner." >&2
            exit 1
          fi
          shopt -s nullglob
          for asset in dist/*.tar.gz dist/*.zip; do
            gpg --batch --yes --armor --pinentry-mode loopback \
              --passphrase-file "${PASSPHRASE_FILE}" \
              --sig-notation "apple-developer-team-id@loctree.io=MW223P3NPX" \
              --sig-notation "release-source@loctree.io=Loctree/aicx" \
              --detach-sign --local-user "${LOCTREE_GPG_KEY_ID}" \
              "${asset}"
          done
          # Export pubkey as release asset so consumers can verify without keyservers.
          gpg --export --armor "${LOCTREE_GPG_KEY_ID}" > dist/loctree-release-pubkey.asc

      - name: Create or update GitHub release
        env:
          GITHUB_TOKEN: ${{ github.token }}
          RELEASE_TAG: ${{ needs.verify.outputs.release_tag }}
          RELEASE_NOTES_PATH: ${{ runner.temp }}/release-notes.md
        run: |
          # Selective glob — never upload directories (gh release upload bails
          # on dirs with "is a directory"; this killed every CI release prior).
          shopt -s nullglob
          assets=( dist/*.tar.gz dist/*.tar.gz.sha256 dist/*.tar.gz.asc \
                   dist/*.zip dist/*.zip.sha256 dist/*.zip.asc \
                   dist/*.notary.json \
                   dist/*.deb dist/*.deb.sha256 dist/*.deb.asc \
                   dist/loctree-release-pubkey.asc )
          if [ "${#assets[@]}" -eq 0 ]; then
            echo "::error::No release assets matched — refusing to create empty release." >&2
            exit 1
          fi
          if gh release view "${RELEASE_TAG}" >/dev/null 2>&1; then
            gh release edit "${RELEASE_TAG}" --notes-file "${RELEASE_NOTES_PATH}"
            gh release upload "${RELEASE_TAG}" "${assets[@]}" --clobber
          else
            gh release create "${RELEASE_TAG}" "${assets[@]}" --notes-file "${RELEASE_NOTES_PATH}"
          fi

      - name: Clean downloaded release artifacts
        if: always()
        run: |
          rm -rf dist
          rm -f "${RUNNER_TEMP}/release-notes.md"