Shared memory and context tools for agentic work.
Code Rooms
name: CI
on:
push:
branches: [main, master]
pull_request:
types: [opened, synchronize, reopened, ready_for_review, converted_to_draft]
merge_group:
schedule:
- cron: '17 3 * * *'
workflow_dispatch:
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: "0"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/master' }}
jobs:
ci-scope:
name: Classify CI scope
runs-on: ubuntu-latest
outputs:
scope: ${{ steps.classify.outputs.scope }}
dependencies: ${{ steps.dependencies.outputs.changed }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
fetch-depth: 0
- id: classify
name: Classify the candidate from the complete Git diff
EVENT_NAME: ${{ github.event_name }}
EVENT_PATH: ${{ github.event_path }}
CANDIDATE: ${{ github.event.pull_request.head.sha || github.sha }}
run: |
python3 scripts/ci_scope.py \
--repo "$GITHUB_WORKSPACE" \
--event-name "$EVENT_NAME" \
--event-path "$EVENT_PATH" \
--candidate "$CANDIDATE" \
--github-output "$GITHUB_OUTPUT"
- id: dependencies
name: Detect dependency-manifest changes for the audit gates
changed="$(python3 scripts/ci_scope.py \
--dependency-domain any || printf 'true')"
case "$changed" in true|false) ;; *) exit 1 ;; esac
echo "changed=$changed" >> "$GITHUB_OUTPUT"
rust-scoped:
name: Scoped Rust invariants and affected crates (${{ matrix.os }})
needs: ci-scope
if: ${{ needs.ci-scope.result == 'success' && fromJSON(needs.ci-scope.outputs.scope).mode == 'scoped' && fromJSON(needs.ci-scope.outputs.scope).rust }}
runs-on: ${{ matrix.os }}
timeout-minutes: 60
CARGO_TARGET_DIR: target
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
- uses: dtolnay/rust-toolchain@4cda84d5c5c54efe2404f9d843567869ab1699d4 # stable
components: clippy,rustfmt
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
key: rust-scoped-${{ matrix.os }}
- uses: taiki-e/install-action@1beb33eee6d086258184383af9a538940be190ed # v2.85.6
tool: cargo-nextest
- name: Run the invariant lightning contract
shell: bash
run: bash scripts/lightning_check.sh
- name: Run affected libraries, binaries and integration tests
SCOPE: ${{ needs.ci-scope.outputs.scope }}
run: python3 scripts/rust_pr_check.py --scope "$SCOPE"
- name: Verify formatting
run: cargo fmt --all --check
rust-full:
name: Full Rust gates (${{ matrix.os }})
if: ${{ needs.ci-scope.result == 'success' && fromJSON(needs.ci-scope.outputs.scope).mode == 'full' }}
timeout-minutes: 120
os: [ubuntu-latest, macos-latest, windows-latest]
key: rust-full-${{ matrix.os }}
- name: Deny clippy warnings
run: cargo clippy --locked --workspace --all-targets -- -D warnings
- name: Test every target
run: cargo test --locked --workspace --all-targets
- name: Run the compile-fail doctests --all-targets cannot reach
run: cargo test --locked --workspace --doc
- name: Build the lean edge nothing else builds
run: cargo check --locked -p m1nd-mcp --no-default-features
- name: Build the complete release workspace on main
if: github.event_name == 'push'
run: cargo build --locked --release --workspace
ui-gates:
name: UI unit, static, browser and accessibility gates
if: ${{ needs.ci-scope.result == 'success' && fromJSON(needs.ci-scope.outputs.scope).ui }}
timeout-minutes: 30
defaults:
run:
working-directory: m1nd-ui
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
node-version: "22"
cache: npm
cache-dependency-path: m1nd-ui/package-lock.json
- run: npm ci
- name: Guarded Vite proxy fixture
run: node --test ../scripts/devkit/ui-dev.test.mjs
- name: Unit tests
run: npm test
- name: Semantic and icon lint
run: npm run lint:soft
- name: ESLint
run: npm run lint
- name: Production build
run: npm run build
- name: Committed bundle matches the source that built it
drift="$(git status --porcelain --ignored=matching -- dist)"
test -z "$drift" || { echo "$drift"; exit 1; }
- name: Install fixture-browser runtime
run: npx playwright install --with-deps chromium
- name: Fixture browser tests
run: npm run test:e2e
- name: Accessibility smoke
run: npm run test:e2e:a11y
host-pack-gates:
name: npm host, pack, update and rollback gates (${{ matrix.os }})
if: ${{ needs.ci-scope.result == 'success' && fromJSON(needs.ci-scope.outputs.scope).host }}
timeout-minutes: 20
- run: npm test
- run: npm run m1nd:pack-check
- run: npm run m1nd:pack-routing-check
- run: npm pack --dry-run
agent-cache-real-gates:
name: Agent cache against native runtime
if: ${{ needs.ci-scope.result == 'success' && fromJSON(needs.ci-scope.outputs.scope).cache }}
timeout-minutes: 45
key: agent-cache-real
- name: Build the native binary exercised by Node
run: cargo build --locked -p m1nd-mcp
- name: Fetch and verify immutable small embedding model
MODEL_DIR: ${{ runner.temp }}/m1nd-test-embed-model
mkdir -m 700 "$MODEL_DIR"
cd "$MODEL_DIR"
base='https://huggingface.co/minishlab/potion-base-8M/resolve/bf8b056651a2c21b8d2565580b8569da283cab23'
for file in config.json model.safetensors tokenizer.json; do
curl --proto '=https' --tlsv1.2 --location --silent --show-error --fail --retry 3 --output "$file" "$base/$file"
done
printf '%s\n' \
'2a6ac0e9aaa356a68a5688070db78fc3a464fefe85d2f06a1905ce3718687553 config.json' \
'f65d0f325faadc1e121c319e2faa41170d3fa07d8c89abd48ca5358d9a223de2 model.safetensors' \
'e67e803f624fb4d67dea1c730d06e1067e1b14d830e2c2202569e3ef0f70bb50 tokenizer.json' | sha256sum --check --strict
- name: Run native cache and lease integration tests without skips
M1ND_TEST_AGENT_CACHE_BINARY: ${{ github.workspace }}/target/debug/m1nd-mcp
M1ND_TEST_EMBED_MODEL: ${{ runner.temp }}/m1nd-test-embed-model
set -o pipefail
test -x "$M1ND_TEST_AGENT_CACHE_BINARY"
node --test --test-concurrency=1 npm/test/agent-cli-cache-real.test.js npm/test/agent-cli-cache-concurrency-real.test.js | tee agent-cache-real.tap
grep -qx '# skipped 0' agent-cache-real.tap
grep -Eq '^# tests [1-9][0-9]*$' agent-cache-real.tap
python-gates:
name: Python proof harnesses
if: ${{ needs.ci-scope.result == 'success' && fromJSON(needs.ci-scope.outputs.scope).python }}
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
python-version: "3.12"
- run: python3 -m unittest discover -s tests -p 'test_*.py' -v
security-gates:
name: Source guard, history secret scan and dependency audits
if: always()
pull-requests: read
- name: Refuse private, operator-only, secret or cache paths in the candidate
run: python3 scripts/m1nd10_candidate_source_guard.py --repo . --revision "$CANDIDATE"
- name: Scan complete candidate history for secrets
GITLEAKS_VERSION: 8.30.1
GITLEAKS_SHA256: 551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb
curl --proto '=https' --tlsv1.2 --location --silent --show-error --fail --output gitleaks.tar.gz "https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz"
echo "${GITLEAKS_SHA256} gitleaks.tar.gz" | sha256sum --check --strict
tar --extract --gzip --file gitleaks.tar.gz gitleaks
./gitleaks git --redact --no-banner --exit-code 1 .
- name: Audit Cargo dependencies on full coverage
cargo install cargo-audit --locked --version 0.22.2
cargo audit --file ./Cargo.lock
- name: Root wrapper remains dependency-free
node - <<'NODE'
const pkg = require('./package.json');
for (const key of ['dependencies', 'devDependencies', 'optionalDependencies']) {
if (pkg[key] && Object.keys(pkg[key]).length) throw new Error('root package unexpectedly has ' + key);
}
NODE
- name: Audit UI dependencies when they changed
mode="$(python3 -c 'import json, os; print(json.loads(os.environ.get("SCOPE", "{}" )).get("mode", "full"))')"
ui_deps="$(python3 scripts/ci_scope.py --repo "$GITHUB_WORKSPACE" --event-name "$EVENT_NAME" --event-path "$EVENT_PATH" --candidate "$CANDIDATE" --dependency-domain ui || printf 'true')"
if [ "$mode" = full ] || [ "$ui_deps" = true ]; then (cd m1nd-ui && npm audit --audit-level=high); else echo 'UI dependency manifest unchanged; audit not selected.'; fi
- name: Review dependency changes on pull requests
if: ${{ github.event_name == 'pull_request' && needs.ci-scope.result == 'success' && needs.ci-scope.outputs.dependencies == 'true' }}
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
fail-on-severity: high
- name: Remove downloaded secret-scanner binary
run: rm -f gitleaks gitleaks.tar.gz
contract-gates:
name: Frozen contracts and documentation coupling
- name: Verify ratified M1ND-10 contract bytes
printf '%s %s\n' \
'2745560daf6e5cf6237b84663f895e81e2c4979de4190dfef649b032b680f87b' 'docs/M1ND-10-PRD.md' \
'd5bc29776f516c300cb1a0668f0a53844286f75395fd0ad1e875b52ea3a067a5' 'docs/M1ND-10-UML.md' | sha256sum --check --strict
- name: Ensure base ref is present
if: github.event_name == 'pull_request'
run: git fetch --no-tags origin "${{ github.base_ref }}"
- name: Enforce agent-workflow documentation coupling
run: python3 scripts/agent_docs_gate.py --base-ref "${{ github.base_ref }}" --event-path "${{ github.event_path }}"
test-status:
name: Test
needs: [ci-scope, rust-scoped, rust-full, ui-gates, host-pack-gates, agent-cache-real-gates, python-gates, security-gates, contract-gates]
- name: Require scope-consistent cumulative gates
NEEDS_JSON: ${{ toJSON(needs) }}
SCOPE_JSON: ${{ needs.ci-scope.outputs.scope }}
run: python3 scripts/ci_gate_status.py