@memnexus-ai/mx-agent-cli 0.1.294 → 0.1.296-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/agents-md-canonicalization.test.js +31 -1
- package/dist/__tests__/agents-md-canonicalization.test.js.map +1 -1
- package/dist/__tests__/behavioral-extraction.test.js +50 -0
- package/dist/__tests__/behavioral-extraction.test.js.map +1 -1
- package/dist/__tests__/bootstrap-behavioral-contract.test.js +6 -3
- package/dist/__tests__/bootstrap-behavioral-contract.test.js.map +1 -1
- package/dist/__tests__/bundle-config.test.js +28 -2
- package/dist/__tests__/bundle-config.test.js.map +1 -1
- package/dist/__tests__/catalog-interaction.test.d.ts +25 -0
- package/dist/__tests__/catalog-interaction.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-interaction.test.js +269 -0
- package/dist/__tests__/catalog-interaction.test.js.map +1 -0
- package/dist/__tests__/catalog-named-memories.test.d.ts +2 -0
- package/dist/__tests__/catalog-named-memories.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-named-memories.test.js +204 -0
- package/dist/__tests__/catalog-named-memories.test.js.map +1 -0
- package/dist/__tests__/catalog-origin-main.test.d.ts +15 -0
- package/dist/__tests__/catalog-origin-main.test.d.ts.map +1 -0
- package/dist/__tests__/catalog-origin-main.test.js +296 -0
- package/dist/__tests__/catalog-origin-main.test.js.map +1 -0
- package/dist/__tests__/catalog.test.d.ts +2 -0
- package/dist/__tests__/catalog.test.d.ts.map +1 -0
- package/dist/__tests__/catalog.test.js +131 -0
- package/dist/__tests__/catalog.test.js.map +1 -0
- package/dist/__tests__/claude-local-sanitizer.test.d.ts +24 -0
- package/dist/__tests__/claude-local-sanitizer.test.d.ts.map +1 -0
- package/dist/__tests__/claude-local-sanitizer.test.js +906 -0
- package/dist/__tests__/claude-local-sanitizer.test.js.map +1 -0
- package/dist/__tests__/cli-build-integration.test.d.ts +2 -0
- package/dist/__tests__/cli-build-integration.test.d.ts.map +1 -0
- package/dist/__tests__/cli-build-integration.test.js +64 -0
- package/dist/__tests__/cli-build-integration.test.js.map +1 -0
- package/dist/__tests__/cli-build.test.d.ts +2 -0
- package/dist/__tests__/cli-build.test.d.ts.map +1 -0
- package/dist/__tests__/cli-build.test.js +640 -0
- package/dist/__tests__/cli-build.test.js.map +1 -0
- package/dist/__tests__/codex-deploy-config.test.js +60 -0
- package/dist/__tests__/codex-deploy-config.test.js.map +1 -1
- package/dist/__tests__/completion-rows-discriminate.test.d.ts +20 -0
- package/dist/__tests__/completion-rows-discriminate.test.d.ts.map +1 -0
- package/dist/__tests__/completion-rows-discriminate.test.js +481 -0
- package/dist/__tests__/completion-rows-discriminate.test.js.map +1 -0
- package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts +2 -0
- package/dist/__tests__/config-fidelity-archived-symlinks.test.d.ts.map +1 -0
- package/dist/__tests__/config-fidelity-archived-symlinks.test.js +127 -0
- package/dist/__tests__/config-fidelity-archived-symlinks.test.js.map +1 -0
- package/dist/__tests__/config-fidelity-display.test.d.ts +2 -0
- package/dist/__tests__/config-fidelity-display.test.d.ts.map +1 -0
- package/dist/__tests__/config-fidelity-display.test.js +77 -0
- package/dist/__tests__/config-fidelity-display.test.js.map +1 -0
- package/dist/__tests__/config-fidelity.test.js +166 -33
- package/dist/__tests__/config-fidelity.test.js.map +1 -1
- package/dist/__tests__/config-generation-gate.test.js +78 -0
- package/dist/__tests__/config-generation-gate.test.js.map +1 -1
- package/dist/__tests__/config-sync.test.js +89 -1
- package/dist/__tests__/config-sync.test.js.map +1 -1
- package/dist/__tests__/coordination-401-production-wiring.test.js +12 -7
- package/dist/__tests__/coordination-401-production-wiring.test.js.map +1 -1
- package/dist/__tests__/coordination-401-recovery.test.js +39 -32
- package/dist/__tests__/coordination-401-recovery.test.js.map +1 -1
- package/dist/__tests__/coordination-brief-pin.test.js +21 -8
- package/dist/__tests__/coordination-brief-pin.test.js.map +1 -1
- package/dist/__tests__/coordination-client.test.js +316 -3
- package/dist/__tests__/coordination-client.test.js.map +1 -1
- package/dist/__tests__/coordination-credential-endpoint.test.d.ts +24 -0
- package/dist/__tests__/coordination-credential-endpoint.test.d.ts.map +1 -0
- package/dist/__tests__/coordination-credential-endpoint.test.js +1290 -0
- package/dist/__tests__/coordination-credential-endpoint.test.js.map +1 -0
- package/dist/__tests__/coordination-memory.test.js +20 -4
- package/dist/__tests__/coordination-memory.test.js.map +1 -1
- package/dist/__tests__/coordination-provision.test.js +22 -14
- package/dist/__tests__/coordination-provision.test.js.map +1 -1
- package/dist/__tests__/coordination-status-registration.test.d.ts +16 -0
- package/dist/__tests__/coordination-status-registration.test.d.ts.map +1 -0
- package/dist/__tests__/coordination-status-registration.test.js +480 -0
- package/dist/__tests__/coordination-status-registration.test.js.map +1 -0
- package/dist/__tests__/coordination-token-multitenant.test.js +24 -24
- package/dist/__tests__/coordination-token-multitenant.test.js.map +1 -1
- package/dist/__tests__/coordination-token.test.js +35 -28
- package/dist/__tests__/coordination-token.test.js.map +1 -1
- package/dist/__tests__/creation-pr-class-check.test.d.ts +17 -0
- package/dist/__tests__/creation-pr-class-check.test.d.ts.map +1 -0
- package/dist/__tests__/creation-pr-class-check.test.js +346 -0
- package/dist/__tests__/creation-pr-class-check.test.js.map +1 -0
- package/dist/__tests__/decision-check.test.d.ts +2 -0
- package/dist/__tests__/decision-check.test.d.ts.map +1 -0
- package/dist/__tests__/decision-check.test.js +105 -0
- package/dist/__tests__/decision-check.test.js.map +1 -0
- package/dist/__tests__/digest-team-omission.test.d.ts +15 -0
- package/dist/__tests__/digest-team-omission.test.d.ts.map +1 -0
- package/dist/__tests__/digest-team-omission.test.js +247 -0
- package/dist/__tests__/digest-team-omission.test.js.map +1 -0
- package/dist/__tests__/doctor-worktree-path.test.d.ts +17 -0
- package/dist/__tests__/doctor-worktree-path.test.d.ts.map +1 -0
- package/dist/__tests__/doctor-worktree-path.test.js +158 -0
- package/dist/__tests__/doctor-worktree-path.test.js.map +1 -0
- package/dist/__tests__/fleet-data.test.js +40 -7
- package/dist/__tests__/fleet-data.test.js.map +1 -1
- package/dist/__tests__/fleet-tmux.test.js +2 -2
- package/dist/__tests__/fleet-tmux.test.js.map +1 -1
- package/dist/__tests__/generate-claude.test.js +137 -3
- package/dist/__tests__/generate-claude.test.js.map +1 -1
- package/dist/__tests__/git-env.test.d.ts +14 -0
- package/dist/__tests__/git-env.test.d.ts.map +1 -0
- package/dist/__tests__/git-env.test.js +131 -0
- package/dist/__tests__/git-env.test.js.map +1 -0
- package/dist/__tests__/git-identity-isolation.test.d.ts +33 -0
- package/dist/__tests__/git-identity-isolation.test.d.ts.map +1 -0
- package/dist/__tests__/git-identity-isolation.test.js +626 -0
- package/dist/__tests__/git-identity-isolation.test.js.map +1 -0
- package/dist/__tests__/harness-extract.test.d.ts +19 -0
- package/dist/__tests__/harness-extract.test.d.ts.map +1 -0
- package/dist/__tests__/harness-extract.test.js +566 -0
- package/dist/__tests__/harness-extract.test.js.map +1 -0
- package/dist/__tests__/harness-wiring.test.d.ts +16 -0
- package/dist/__tests__/harness-wiring.test.d.ts.map +1 -0
- package/dist/__tests__/harness-wiring.test.js +469 -0
- package/dist/__tests__/harness-wiring.test.js.map +1 -0
- package/dist/__tests__/hook-heal.test.js +17 -0
- package/dist/__tests__/hook-heal.test.js.map +1 -1
- package/dist/__tests__/init-coordination-url.test.d.ts +11 -0
- package/dist/__tests__/init-coordination-url.test.d.ts.map +1 -0
- package/dist/__tests__/init-coordination-url.test.js +114 -0
- package/dist/__tests__/init-coordination-url.test.js.map +1 -0
- package/dist/__tests__/memory-autocreate.test.js +574 -8
- package/dist/__tests__/memory-autocreate.test.js.map +1 -1
- package/dist/__tests__/memory-log-result.test.d.ts +13 -0
- package/dist/__tests__/memory-log-result.test.d.ts.map +1 -0
- package/dist/__tests__/memory-log-result.test.js +113 -0
- package/dist/__tests__/memory-log-result.test.js.map +1 -0
- package/dist/__tests__/memory-named-exists.test.d.ts +16 -0
- package/dist/__tests__/memory-named-exists.test.d.ts.map +1 -0
- package/dist/__tests__/memory-named-exists.test.js +288 -0
- package/dist/__tests__/memory-named-exists.test.js.map +1 -0
- package/dist/__tests__/mx-agent-cli-pin-validation.test.js +23 -47
- package/dist/__tests__/mx-agent-cli-pin-validation.test.js.map +1 -1
- package/dist/__tests__/mx-agent-cli-version-pin.test.js +34 -88
- package/dist/__tests__/mx-agent-cli-version-pin.test.js.map +1 -1
- package/dist/__tests__/new-project-first-team.test.d.ts +15 -0
- package/dist/__tests__/new-project-first-team.test.d.ts.map +1 -0
- package/dist/__tests__/new-project-first-team.test.js +263 -0
- package/dist/__tests__/new-project-first-team.test.js.map +1 -0
- package/dist/__tests__/otel-env.test.d.ts +2 -0
- package/dist/__tests__/otel-env.test.d.ts.map +1 -0
- package/dist/__tests__/otel-env.test.js +127 -0
- package/dist/__tests__/otel-env.test.js.map +1 -0
- package/dist/__tests__/project-config.test.js +283 -1
- package/dist/__tests__/project-config.test.js.map +1 -1
- package/dist/__tests__/provision-behavioral-contract.test.js +96 -4
- package/dist/__tests__/provision-behavioral-contract.test.js.map +1 -1
- package/dist/__tests__/provision-catalog-precondition.test.d.ts +26 -0
- package/dist/__tests__/provision-catalog-precondition.test.d.ts.map +1 -0
- package/dist/__tests__/provision-catalog-precondition.test.js +620 -0
- package/dist/__tests__/provision-catalog-precondition.test.js.map +1 -0
- package/dist/__tests__/provision-completion-rows.test.d.ts +17 -0
- package/dist/__tests__/provision-completion-rows.test.d.ts.map +1 -0
- package/dist/__tests__/provision-completion-rows.test.js +3187 -0
- package/dist/__tests__/provision-completion-rows.test.js.map +1 -0
- package/dist/__tests__/provision-identity-gate.test.d.ts +20 -0
- package/dist/__tests__/provision-identity-gate.test.d.ts.map +1 -0
- package/dist/__tests__/provision-identity-gate.test.js +600 -0
- package/dist/__tests__/provision-identity-gate.test.js.map +1 -0
- package/dist/__tests__/provision-resume.test.d.ts +26 -0
- package/dist/__tests__/provision-resume.test.d.ts.map +1 -0
- package/dist/__tests__/provision-resume.test.js +1164 -0
- package/dist/__tests__/provision-resume.test.js.map +1 -0
- package/dist/__tests__/provision-roleguide-anchors.test.d.ts +27 -0
- package/dist/__tests__/provision-roleguide-anchors.test.d.ts.map +1 -0
- package/dist/__tests__/provision-roleguide-anchors.test.js +747 -0
- package/dist/__tests__/provision-roleguide-anchors.test.js.map +1 -0
- package/dist/__tests__/provision-skeleton-fill.test.d.ts +16 -0
- package/dist/__tests__/provision-skeleton-fill.test.d.ts.map +1 -0
- package/dist/__tests__/provision-skeleton-fill.test.js +488 -0
- package/dist/__tests__/provision-skeleton-fill.test.js.map +1 -0
- package/dist/__tests__/provision-teambuilder-flow.test.js +93 -7
- package/dist/__tests__/provision-teambuilder-flow.test.js.map +1 -1
- package/dist/__tests__/repo-guard-wiring.test.d.ts +21 -0
- package/dist/__tests__/repo-guard-wiring.test.d.ts.map +1 -0
- package/dist/__tests__/repo-guard-wiring.test.js +638 -0
- package/dist/__tests__/repo-guard-wiring.test.js.map +1 -0
- package/dist/__tests__/report-format.test.d.ts +2 -0
- package/dist/__tests__/report-format.test.d.ts.map +1 -0
- package/dist/__tests__/report-format.test.js +219 -0
- package/dist/__tests__/report-format.test.js.map +1 -0
- package/dist/__tests__/row15-detail-sanitizer.test.d.ts +20 -0
- package/dist/__tests__/row15-detail-sanitizer.test.d.ts.map +1 -0
- package/dist/__tests__/row15-detail-sanitizer.test.js +61 -0
- package/dist/__tests__/row15-detail-sanitizer.test.js.map +1 -0
- package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts +2 -0
- package/dist/__tests__/runtime-codex-gateway-pilot.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-codex-gateway-pilot.test.js +309 -0
- package/dist/__tests__/runtime-codex-gateway-pilot.test.js.map +1 -0
- package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts +2 -0
- package/dist/__tests__/runtime-codex-gateway-provider.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-codex-gateway-provider.test.js +163 -0
- package/dist/__tests__/runtime-codex-gateway-provider.test.js.map +1 -0
- package/dist/__tests__/runtime-identity.test.d.ts +2 -0
- package/dist/__tests__/runtime-identity.test.d.ts.map +1 -0
- package/dist/__tests__/runtime-identity.test.js +117 -0
- package/dist/__tests__/runtime-identity.test.js.map +1 -0
- package/dist/__tests__/session-pause-provisioning.test.js +6 -1
- package/dist/__tests__/session-pause-provisioning.test.js.map +1 -1
- package/dist/__tests__/session-record-disclosure.test.d.ts +24 -0
- package/dist/__tests__/session-record-disclosure.test.d.ts.map +1 -0
- package/dist/__tests__/session-record-disclosure.test.js +494 -0
- package/dist/__tests__/session-record-disclosure.test.js.map +1 -0
- package/dist/__tests__/session.test.js +35 -0
- package/dist/__tests__/session.test.js.map +1 -1
- package/dist/__tests__/slug-validation.test.js +27 -21
- package/dist/__tests__/slug-validation.test.js.map +1 -1
- package/dist/__tests__/standards-injection.test.d.ts +2 -0
- package/dist/__tests__/standards-injection.test.d.ts.map +1 -0
- package/dist/__tests__/standards-injection.test.js +179 -0
- package/dist/__tests__/standards-injection.test.js.map +1 -0
- package/dist/__tests__/start-interactive-role.test.d.ts +22 -0
- package/dist/__tests__/start-interactive-role.test.d.ts.map +1 -0
- package/dist/__tests__/start-interactive-role.test.js +204 -0
- package/dist/__tests__/start-interactive-role.test.js.map +1 -0
- package/dist/__tests__/start-team-identity.test.d.ts +25 -0
- package/dist/__tests__/start-team-identity.test.d.ts.map +1 -0
- package/dist/__tests__/start-team-identity.test.js +307 -0
- package/dist/__tests__/start-team-identity.test.js.map +1 -0
- package/dist/__tests__/team-memory-commands.test.js +142 -19
- package/dist/__tests__/team-memory-commands.test.js.map +1 -1
- package/dist/__tests__/template-sync.test.d.ts +19 -0
- package/dist/__tests__/template-sync.test.d.ts.map +1 -0
- package/dist/__tests__/template-sync.test.js +270 -0
- package/dist/__tests__/template-sync.test.js.map +1 -0
- package/dist/__tests__/test-project.test.d.ts +18 -0
- package/dist/__tests__/test-project.test.d.ts.map +1 -0
- package/dist/__tests__/test-project.test.js +465 -0
- package/dist/__tests__/test-project.test.js.map +1 -0
- package/dist/__tests__/usage-per-call-grouping.test.d.ts +25 -0
- package/dist/__tests__/usage-per-call-grouping.test.d.ts.map +1 -0
- package/dist/__tests__/usage-per-call-grouping.test.js +952 -0
- package/dist/__tests__/usage-per-call-grouping.test.js.map +1 -0
- package/dist/__tests__/verify-hooks-check-all.test.d.ts +32 -0
- package/dist/__tests__/verify-hooks-check-all.test.d.ts.map +1 -0
- package/dist/__tests__/verify-hooks-check-all.test.js +553 -0
- package/dist/__tests__/verify-hooks-check-all.test.js.map +1 -0
- package/dist/__tests__/worktree-sync-fixture.test.d.ts +17 -0
- package/dist/__tests__/worktree-sync-fixture.test.d.ts.map +1 -0
- package/dist/__tests__/worktree-sync-fixture.test.js +519 -0
- package/dist/__tests__/worktree-sync-fixture.test.js.map +1 -0
- package/dist/__tests__/worktree-sync-hardening.test.d.ts +13 -0
- package/dist/__tests__/worktree-sync-hardening.test.d.ts.map +1 -0
- package/dist/__tests__/worktree-sync-hardening.test.js +919 -0
- package/dist/__tests__/worktree-sync-hardening.test.js.map +1 -0
- package/dist/__tests__/worktree-sync-shell-free.test.d.ts +25 -0
- package/dist/__tests__/worktree-sync-shell-free.test.d.ts.map +1 -0
- package/dist/__tests__/worktree-sync-shell-free.test.js +185 -0
- package/dist/__tests__/worktree-sync-shell-free.test.js.map +1 -0
- package/dist/__tests__/worktree.test.js +75 -1
- package/dist/__tests__/worktree.test.js.map +1 -1
- package/dist/agent-config/.mx-config-generation.json +2 -2
- package/dist/agent-config/AGENTS.md.template +2 -2
- package/dist/agent-config/agents/bar-raiser.md +34 -1
- package/dist/agent-config/agents/red-team.md +34 -1
- package/dist/agent-config/agents/security-reviewer.md +22 -1
- package/dist/agent-config/claude-md/CLAUDE.core.md +6 -1
- package/dist/agent-config/claude-md/CLAUDE.overlay.memnexus.md +1 -3
- package/dist/agent-config/coordination-rosters.generated.json +10 -0
- package/dist/agent-config/hooks/HOOK-TIMEOUTS.md +27 -1
- package/dist/agent-config/hooks/OR-TRUE-AUDIT.md +8 -8
- package/dist/agent-config/hooks/auto-capture-precompact.sh +180 -83
- package/dist/agent-config/hooks/auto-capture-session-end.sh +216 -87
- package/dist/agent-config/hooks/auto-checkpoint.sh +75 -5
- package/dist/agent-config/hooks/coordination-brief.sh +290 -245
- package/dist/agent-config/hooks/deploy-verification-reminder.sh +359 -22
- package/dist/agent-config/hooks/git-mutation-guard.sh +85 -13
- package/dist/agent-config/hooks/observability-sync.sh +46 -9
- package/dist/agent-config/hooks/session-idle-gate.sh +177 -12
- package/dist/agent-config/hooks/subagent-write-guard.sh +670 -0
- package/dist/agent-config/hooks/worktree-guard.sh +36 -7
- package/dist/agent-config/settings.json +15 -2
- package/dist/agent-config/shared/creation-pr-review-checklist.md +317 -0
- package/dist/commands/bootstrap.d.ts.map +1 -1
- package/dist/commands/bootstrap.js +22 -10
- package/dist/commands/bootstrap.js.map +1 -1
- package/dist/commands/config-sync.d.ts +37 -0
- package/dist/commands/config-sync.d.ts.map +1 -1
- package/dist/commands/config-sync.js +36 -18
- package/dist/commands/config-sync.js.map +1 -1
- package/dist/commands/config.d.ts.map +1 -1
- package/dist/commands/config.js +28 -1
- package/dist/commands/config.js.map +1 -1
- package/dist/commands/coordination.d.ts +150 -8
- package/dist/commands/coordination.d.ts.map +1 -1
- package/dist/commands/coordination.js +524 -25
- package/dist/commands/coordination.js.map +1 -1
- package/dist/commands/create.d.ts +922 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +4934 -345
- package/dist/commands/create.js.map +1 -1
- package/dist/commands/dashboard.d.ts.map +1 -1
- package/dist/commands/dashboard.js +10 -2
- package/dist/commands/dashboard.js.map +1 -1
- package/dist/commands/decision.d.ts +20 -0
- package/dist/commands/decision.d.ts.map +1 -0
- package/dist/commands/decision.js +54 -0
- package/dist/commands/decision.js.map +1 -0
- package/dist/commands/digest.d.ts.map +1 -1
- package/dist/commands/digest.js +91 -7
- package/dist/commands/digest.js.map +1 -1
- package/dist/commands/fleet-tmux.js +1 -1
- package/dist/commands/fleet-tmux.js.map +1 -1
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +26 -1
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/list.d.ts +32 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +98 -5
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/monitor.d.ts.map +1 -1
- package/dist/commands/monitor.js +8 -2
- package/dist/commands/monitor.js.map +1 -1
- package/dist/commands/new.d.ts +2 -0
- package/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +114 -21
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/report.d.ts +33 -0
- package/dist/commands/report.d.ts.map +1 -0
- package/dist/commands/report.js +73 -0
- package/dist/commands/report.js.map +1 -0
- package/dist/commands/session.js +1 -1
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/start.d.ts +42 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +183 -8
- package/dist/commands/start.js.map +1 -1
- package/dist/commands/sync.d.ts +57 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +117 -3
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/update.d.ts +13 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +50 -1
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/usage.d.ts +64 -0
- package/dist/commands/usage.d.ts.map +1 -1
- package/dist/commands/usage.js +96 -3
- package/dist/commands/usage.js.map +1 -1
- package/dist/commands/verify-hooks.d.ts +37 -1
- package/dist/commands/verify-hooks.d.ts.map +1 -1
- package/dist/commands/verify-hooks.js +114 -2
- package/dist/commands/verify-hooks.js.map +1 -1
- package/dist/commands/window.d.ts +10 -0
- package/dist/commands/window.d.ts.map +1 -0
- package/dist/commands/window.js +265 -0
- package/dist/commands/window.js.map +1 -0
- package/dist/commands/worktree-sync.d.ts +54 -0
- package/dist/commands/worktree-sync.d.ts.map +1 -0
- package/dist/commands/worktree-sync.js +135 -0
- package/dist/commands/worktree-sync.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +189 -14
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-session.d.ts +12 -0
- package/dist/lib/agent-session.d.ts.map +1 -1
- package/dist/lib/agent-session.js +189 -42
- package/dist/lib/agent-session.js.map +1 -1
- package/dist/lib/behavioral-injection.d.ts +9 -0
- package/dist/lib/behavioral-injection.d.ts.map +1 -1
- package/dist/lib/behavioral-injection.js +10 -1
- package/dist/lib/behavioral-injection.js.map +1 -1
- package/dist/lib/catalog.d.ts +321 -2
- package/dist/lib/catalog.d.ts.map +1 -1
- package/dist/lib/catalog.js +490 -11
- package/dist/lib/catalog.js.map +1 -1
- package/dist/lib/claude.d.ts +113 -23
- package/dist/lib/claude.d.ts.map +1 -1
- package/dist/lib/claude.js +498 -32
- package/dist/lib/claude.js.map +1 -1
- package/dist/lib/cli-build.d.ts +172 -0
- package/dist/lib/cli-build.d.ts.map +1 -0
- package/dist/lib/cli-build.js +654 -0
- package/dist/lib/cli-build.js.map +1 -0
- package/dist/lib/code-context-file.d.ts +109 -0
- package/dist/lib/code-context-file.d.ts.map +1 -0
- package/dist/lib/code-context-file.js +219 -0
- package/dist/lib/code-context-file.js.map +1 -0
- package/dist/lib/code-context-file.test.d.ts +19 -0
- package/dist/lib/code-context-file.test.d.ts.map +1 -0
- package/dist/lib/code-context-file.test.js +202 -0
- package/dist/lib/code-context-file.test.js.map +1 -0
- package/dist/lib/config-fidelity.d.ts +40 -20
- package/dist/lib/config-fidelity.d.ts.map +1 -1
- package/dist/lib/config-fidelity.js +144 -56
- package/dist/lib/config-fidelity.js.map +1 -1
- package/dist/lib/coordination-client.d.ts +101 -0
- package/dist/lib/coordination-client.d.ts.map +1 -1
- package/dist/lib/coordination-client.js +232 -8
- package/dist/lib/coordination-client.js.map +1 -1
- package/dist/lib/coordination-token.d.ts +333 -6
- package/dist/lib/coordination-token.d.ts.map +1 -1
- package/dist/lib/coordination-token.js +875 -52
- package/dist/lib/coordination-token.js.map +1 -1
- package/dist/lib/decision-check.d.ts +48 -0
- package/dist/lib/decision-check.d.ts.map +1 -0
- package/dist/lib/decision-check.js +149 -0
- package/dist/lib/decision-check.js.map +1 -0
- package/dist/lib/fleet-data.d.ts +34 -0
- package/dist/lib/fleet-data.d.ts.map +1 -1
- package/dist/lib/fleet-data.js +37 -9
- package/dist/lib/fleet-data.js.map +1 -1
- package/dist/lib/fleet-render.js +1 -1
- package/dist/lib/fleet-render.js.map +1 -1
- package/dist/lib/git-identity.d.ts +302 -0
- package/dist/lib/git-identity.d.ts.map +1 -0
- package/dist/lib/git-identity.js +546 -0
- package/dist/lib/git-identity.js.map +1 -0
- package/dist/lib/harness/console/announce.d.ts +45 -0
- package/dist/lib/harness/console/announce.d.ts.map +1 -0
- package/dist/lib/harness/console/announce.js +48 -0
- package/dist/lib/harness/console/announce.js.map +1 -0
- package/dist/lib/harness/console/announce.test.d.ts +2 -0
- package/dist/lib/harness/console/announce.test.d.ts.map +1 -0
- package/dist/lib/harness/console/announce.test.js +104 -0
- package/dist/lib/harness/console/announce.test.js.map +1 -0
- package/dist/lib/harness/console/by-session.d.ts +50 -0
- package/dist/lib/harness/console/by-session.d.ts.map +1 -0
- package/dist/lib/harness/console/by-session.js +83 -0
- package/dist/lib/harness/console/by-session.js.map +1 -0
- package/dist/lib/harness/console/by-session.test.d.ts +2 -0
- package/dist/lib/harness/console/by-session.test.d.ts.map +1 -0
- package/dist/lib/harness/console/by-session.test.js +86 -0
- package/dist/lib/harness/console/by-session.test.js.map +1 -0
- package/dist/lib/harness/console/console.d.ts +67 -0
- package/dist/lib/harness/console/console.d.ts.map +1 -0
- package/dist/lib/harness/console/console.js +373 -0
- package/dist/lib/harness/console/console.js.map +1 -0
- package/dist/lib/harness/console/console.test.d.ts +2 -0
- package/dist/lib/harness/console/console.test.d.ts.map +1 -0
- package/dist/lib/harness/console/console.test.js +269 -0
- package/dist/lib/harness/console/console.test.js.map +1 -0
- package/dist/lib/harness/console/decision-request.d.ts +32 -0
- package/dist/lib/harness/console/decision-request.d.ts.map +1 -0
- package/dist/lib/harness/console/decision-request.js +112 -0
- package/dist/lib/harness/console/decision-request.js.map +1 -0
- package/dist/lib/harness/console/decision-request.test.d.ts +2 -0
- package/dist/lib/harness/console/decision-request.test.d.ts.map +1 -0
- package/dist/lib/harness/console/decision-request.test.js +75 -0
- package/dist/lib/harness/console/decision-request.test.js.map +1 -0
- package/dist/lib/harness/console/fixtures.d.ts +16 -0
- package/dist/lib/harness/console/fixtures.d.ts.map +1 -0
- package/dist/lib/harness/console/fixtures.js +49 -0
- package/dist/lib/harness/console/fixtures.js.map +1 -0
- package/dist/lib/harness/console/index.d.ts +15 -0
- package/dist/lib/harness/console/index.d.ts.map +1 -0
- package/dist/lib/harness/console/index.js +14 -0
- package/dist/lib/harness/console/index.js.map +1 -0
- package/dist/lib/harness/console/rank.d.ts +73 -0
- package/dist/lib/harness/console/rank.d.ts.map +1 -0
- package/dist/lib/harness/console/rank.js +113 -0
- package/dist/lib/harness/console/rank.js.map +1 -0
- package/dist/lib/harness/console/rank.test.d.ts +2 -0
- package/dist/lib/harness/console/rank.test.d.ts.map +1 -0
- package/dist/lib/harness/console/rank.test.js +124 -0
- package/dist/lib/harness/console/rank.test.js.map +1 -0
- package/dist/lib/harness/console/render.d.ts +22 -0
- package/dist/lib/harness/console/render.d.ts.map +1 -0
- package/dist/lib/harness/console/render.js +65 -0
- package/dist/lib/harness/console/render.js.map +1 -0
- package/dist/lib/harness/console/render.test.d.ts +2 -0
- package/dist/lib/harness/console/render.test.d.ts.map +1 -0
- package/dist/lib/harness/console/render.test.js +96 -0
- package/dist/lib/harness/console/render.test.js.map +1 -0
- package/dist/lib/harness/console/replay-cli.test.d.ts +2 -0
- package/dist/lib/harness/console/replay-cli.test.d.ts.map +1 -0
- package/dist/lib/harness/console/replay-cli.test.js +96 -0
- package/dist/lib/harness/console/replay-cli.test.js.map +1 -0
- package/dist/lib/harness/console/replay.d.ts +36 -0
- package/dist/lib/harness/console/replay.d.ts.map +1 -0
- package/dist/lib/harness/console/replay.js +59 -0
- package/dist/lib/harness/console/replay.js.map +1 -0
- package/dist/lib/harness/console/replay.test.d.ts +2 -0
- package/dist/lib/harness/console/replay.test.d.ts.map +1 -0
- package/dist/lib/harness/console/replay.test.js +81 -0
- package/dist/lib/harness/console/replay.test.js.map +1 -0
- package/dist/lib/harness/console/turn-reader.d.ts +50 -0
- package/dist/lib/harness/console/turn-reader.d.ts.map +1 -0
- package/dist/lib/harness/console/turn-reader.js +184 -0
- package/dist/lib/harness/console/turn-reader.js.map +1 -0
- package/dist/lib/harness/console/turn-reader.test.d.ts +2 -0
- package/dist/lib/harness/console/turn-reader.test.d.ts.map +1 -0
- package/dist/lib/harness/console/turn-reader.test.js +108 -0
- package/dist/lib/harness/console/turn-reader.test.js.map +1 -0
- package/dist/lib/harness/console/types.d.ts +109 -0
- package/dist/lib/harness/console/types.d.ts.map +1 -0
- package/dist/lib/harness/console/types.js +2 -0
- package/dist/lib/harness/console/types.js.map +1 -0
- package/dist/lib/harness/contract.d.ts +229 -0
- package/dist/lib/harness/contract.d.ts.map +1 -0
- package/dist/lib/harness/contract.js +22 -0
- package/dist/lib/harness/contract.js.map +1 -0
- package/dist/lib/harness/credential.d.ts +23 -0
- package/dist/lib/harness/credential.d.ts.map +1 -0
- package/dist/lib/harness/credential.js +81 -0
- package/dist/lib/harness/credential.js.map +1 -0
- package/dist/lib/harness/credential.test.d.ts +2 -0
- package/dist/lib/harness/credential.test.d.ts.map +1 -0
- package/dist/lib/harness/credential.test.js +74 -0
- package/dist/lib/harness/credential.test.js.map +1 -0
- package/dist/lib/harness/evaluate.d.ts +390 -0
- package/dist/lib/harness/evaluate.d.ts.map +1 -0
- package/dist/lib/harness/evaluate.js +988 -0
- package/dist/lib/harness/evaluate.js.map +1 -0
- package/dist/lib/harness/evaluate.test.d.ts +2 -0
- package/dist/lib/harness/evaluate.test.d.ts.map +1 -0
- package/dist/lib/harness/evaluate.test.js +621 -0
- package/dist/lib/harness/evaluate.test.js.map +1 -0
- package/dist/lib/harness/extract.d.ts +152 -0
- package/dist/lib/harness/extract.d.ts.map +1 -0
- package/dist/lib/harness/extract.js +1601 -0
- package/dist/lib/harness/extract.js.map +1 -0
- package/dist/lib/harness/gate.d.ts +48 -0
- package/dist/lib/harness/gate.d.ts.map +1 -0
- package/dist/lib/harness/gate.js +60 -0
- package/dist/lib/harness/gate.js.map +1 -0
- package/dist/lib/harness/gate.test.d.ts +2 -0
- package/dist/lib/harness/gate.test.d.ts.map +1 -0
- package/dist/lib/harness/gate.test.js +111 -0
- package/dist/lib/harness/gate.test.js.map +1 -0
- package/dist/lib/harness/self-check.d.ts +59 -0
- package/dist/lib/harness/self-check.d.ts.map +1 -0
- package/dist/lib/harness/self-check.js +56 -0
- package/dist/lib/harness/self-check.js.map +1 -0
- package/dist/lib/harness/self-check.test.d.ts +2 -0
- package/dist/lib/harness/self-check.test.d.ts.map +1 -0
- package/dist/lib/harness/self-check.test.js +43 -0
- package/dist/lib/harness/self-check.test.js.map +1 -0
- package/dist/lib/harness/transcript.d.ts +65 -0
- package/dist/lib/harness/transcript.d.ts.map +1 -0
- package/dist/lib/harness/transcript.js +144 -0
- package/dist/lib/harness/transcript.js.map +1 -0
- package/dist/lib/harness/transcript.test.d.ts +2 -0
- package/dist/lib/harness/transcript.test.d.ts.map +1 -0
- package/dist/lib/harness/transcript.test.js +118 -0
- package/dist/lib/harness/transcript.test.js.map +1 -0
- package/dist/lib/harness-wiring.d.ts +145 -0
- package/dist/lib/harness-wiring.d.ts.map +1 -0
- package/dist/lib/harness-wiring.js +280 -0
- package/dist/lib/harness-wiring.js.map +1 -0
- package/dist/lib/hook-staleness.d.ts +95 -0
- package/dist/lib/hook-staleness.d.ts.map +1 -0
- package/dist/lib/hook-staleness.js +304 -0
- package/dist/lib/hook-staleness.js.map +1 -0
- package/dist/lib/jsonl.d.ts +270 -2
- package/dist/lib/jsonl.d.ts.map +1 -1
- package/dist/lib/jsonl.js +472 -76
- package/dist/lib/jsonl.js.map +1 -1
- package/dist/lib/memory.d.ts +350 -23
- package/dist/lib/memory.d.ts.map +1 -1
- package/dist/lib/memory.js +751 -38
- package/dist/lib/memory.js.map +1 -1
- package/dist/lib/otel-env.d.ts +90 -0
- package/dist/lib/otel-env.d.ts.map +1 -0
- package/dist/lib/otel-env.js +98 -0
- package/dist/lib/otel-env.js.map +1 -0
- package/dist/lib/project-config.d.ts +167 -0
- package/dist/lib/project-config.d.ts.map +1 -1
- package/dist/lib/project-config.js +321 -5
- package/dist/lib/project-config.js.map +1 -1
- package/dist/lib/projects-registry.d.ts +82 -0
- package/dist/lib/projects-registry.d.ts.map +1 -0
- package/dist/lib/projects-registry.js +145 -0
- package/dist/lib/projects-registry.js.map +1 -0
- package/dist/lib/projects-registry.test.d.ts +2 -0
- package/dist/lib/projects-registry.test.d.ts.map +1 -0
- package/dist/lib/projects-registry.test.js +176 -0
- package/dist/lib/projects-registry.test.js.map +1 -0
- package/dist/lib/repo-guard-scope.d.ts +126 -0
- package/dist/lib/repo-guard-scope.d.ts.map +1 -0
- package/dist/lib/repo-guard-scope.js +249 -0
- package/dist/lib/repo-guard-scope.js.map +1 -0
- package/dist/lib/report-format.d.ts +132 -0
- package/dist/lib/report-format.d.ts.map +1 -0
- package/dist/lib/report-format.js +317 -0
- package/dist/lib/report-format.js.map +1 -0
- package/dist/lib/roster.d.ts +99 -0
- package/dist/lib/roster.d.ts.map +1 -0
- package/dist/lib/roster.js +336 -0
- package/dist/lib/roster.js.map +1 -0
- package/dist/lib/roster.test.d.ts +15 -0
- package/dist/lib/roster.test.d.ts.map +1 -0
- package/dist/lib/roster.test.js +299 -0
- package/dist/lib/roster.test.js.map +1 -0
- package/dist/lib/runtime/codex-adapter.d.ts.map +1 -1
- package/dist/lib/runtime/codex-adapter.js +5 -0
- package/dist/lib/runtime/codex-adapter.js.map +1 -1
- package/dist/lib/runtime/codex-config.d.ts +129 -0
- package/dist/lib/runtime/codex-config.d.ts.map +1 -1
- package/dist/lib/runtime/codex-config.js +225 -0
- package/dist/lib/runtime/codex-config.js.map +1 -1
- package/dist/lib/runtime/identity.d.ts +72 -0
- package/dist/lib/runtime/identity.d.ts.map +1 -0
- package/dist/lib/runtime/identity.js +128 -0
- package/dist/lib/runtime/identity.js.map +1 -0
- package/dist/lib/standards.d.ts +99 -0
- package/dist/lib/standards.d.ts.map +1 -0
- package/dist/lib/standards.js +201 -0
- package/dist/lib/standards.js.map +1 -0
- package/dist/lib/team-identity.d.ts +134 -0
- package/dist/lib/team-identity.d.ts.map +1 -0
- package/dist/lib/team-identity.js +193 -0
- package/dist/lib/team-identity.js.map +1 -0
- package/dist/lib/templates.d.ts +29 -2
- package/dist/lib/templates.d.ts.map +1 -1
- package/dist/lib/templates.js +1042 -82
- package/dist/lib/templates.js.map +1 -1
- package/dist/lib/terminal-ui.d.ts.map +1 -1
- package/dist/lib/terminal-ui.js +12 -1
- package/dist/lib/terminal-ui.js.map +1 -1
- package/dist/lib/test-project.d.ts +95 -0
- package/dist/lib/test-project.d.ts.map +1 -0
- package/dist/lib/test-project.js +103 -0
- package/dist/lib/test-project.js.map +1 -0
- package/dist/lib/vault.d.ts +60 -0
- package/dist/lib/vault.d.ts.map +1 -0
- package/dist/lib/vault.js +102 -0
- package/dist/lib/vault.js.map +1 -0
- package/dist/lib/vault.test.d.ts +17 -0
- package/dist/lib/vault.test.d.ts.map +1 -0
- package/dist/lib/vault.test.js +169 -0
- package/dist/lib/vault.test.js.map +1 -0
- package/dist/lib/window-view.d.ts +63 -0
- package/dist/lib/window-view.d.ts.map +1 -0
- package/dist/lib/window-view.js +217 -0
- package/dist/lib/window-view.js.map +1 -0
- package/dist/lib/window-view.test.d.ts +2 -0
- package/dist/lib/window-view.test.d.ts.map +1 -0
- package/dist/lib/window-view.test.js +168 -0
- package/dist/lib/window-view.test.js.map +1 -0
- package/dist/lib/worktree-sync.d.ts +439 -0
- package/dist/lib/worktree-sync.d.ts.map +1 -0
- package/dist/lib/worktree-sync.js +1167 -0
- package/dist/lib/worktree-sync.js.map +1 -0
- package/dist/lib/worktree.d.ts +58 -1
- package/dist/lib/worktree.d.ts.map +1 -1
- package/dist/lib/worktree.js +91 -4
- package/dist/lib/worktree.js.map +1 -1
- package/dist/standards/decision-request.md +98 -0
- package/dist/standards/fail-loud-standard.md +495 -0
- package/dist/standards/po-communication-standard.md +126 -0
- package/dist/standards/report-format.md +128 -0
- package/dist/standards/writing-standard.md +382 -0
- package/package.json +3 -2
- package/scripts/generate-claude.mjs +119 -46
|
@@ -93,7 +93,7 @@ SHA, the three-step job-log procedure for proving which base a CI run checked ou
|
|
|
93
93
|
empty grep result is the *default* rather than a pass, and the withdrawn
|
|
94
94
|
`merge_commit_sha` check (#4942).
|
|
95
95
|
|
|
96
|
-
|
|
96
|
+
The two rules below, through the stale merge ref bullet, are load-bearing enough to state here as well as there:
|
|
97
97
|
|
|
98
98
|
- **Stale API view (#5086).** After any force-push, amend, or rebase: `git fetch origin
|
|
99
99
|
<branch>` and diff the ref locally. Never review from `gh pr view` / `gh pr diff` alone —
|
|
@@ -113,6 +113,27 @@ These two rules are load-bearing enough to state here as well as there:
|
|
|
113
113
|
`merge_commit_sha` polling check was disproved on #4942 — do not use it; details in the
|
|
114
114
|
shared file.
|
|
115
115
|
|
|
116
|
+
- **Scope. Test for the wrapper before you decide the Codex review is owed.** This file
|
|
117
|
+
ships to more than one repository, so establish which one you are in first:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
git remote get-url origin # which repository is under review
|
|
121
|
+
ls dev-tools/scripts/codex-review.sh # the wrapper: present or absent
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**If the wrapper is absent, the Codex differential review is not part of your verdict.
|
|
125
|
+
Do not run it, and do not record it as owed or as skipped.** Absent means absent from
|
|
126
|
+
the repository under review, not missing from your worktree, so confirm against
|
|
127
|
+
`origin/main` rather than an uncommitted state.
|
|
128
|
+
|
|
129
|
+
`mx-agent-framework` is the worked instance. `dev-tools/scripts/codex-review.sh` does
|
|
130
|
+
not exist there and never has: `git log --all --diff-filter=D -- '*codex-review.sh'`
|
|
131
|
+
returns nothing, and `git ls-tree -r origin/main --name-only -- dev-tools/` returns only
|
|
132
|
+
two files under `dev-tools/wsl/`. The product owner scoped the requirement out of that
|
|
133
|
+
repository on 2026-09-01, and the `/codex` skill was removed from its agent-config the
|
|
134
|
+
same day. Issue #222 records that it was could-not-run on every pull request that
|
|
135
|
+
repository shipped. The bullets below, through the `--exclude` bullet, apply when you
|
|
136
|
+
review in a repository that ships the wrapper.
|
|
116
137
|
- The Codex differential review is a locally-run script, not a CI job, so "a comment
|
|
117
138
|
exists" is not evidence it ran clean. Check the **exit status**, and record the SHA
|
|
118
139
|
yourself:
|
|
@@ -92,11 +92,16 @@ Sync URL is pre-configured in the StopHook.
|
|
|
92
92
|
A PR is not done when it merges. It is done when it deploys and the deploy is verified.
|
|
93
93
|
|
|
94
94
|
1. Sync branch with main. Run `/mx-post-merge-sync`. If unavailable: `git fetch origin main && git rebase origin/main`. Verify: `git rev-list --count HEAD..origin/main` returns 0.
|
|
95
|
-
2. Verify deployment succeeded. Get the merge SHA (`gh pr view <N> --json mergeCommit`), poll the pipeline (`gh run list --commit <sha>`), confirm the artifact is live (npm publish for CLI; deploy workflow `success` for services).
|
|
95
|
+
2. Verify deployment succeeded. Get the merge SHA (`gh pr view <N> --json mergeCommit`), poll the pipeline (`gh run list --commit <sha>`), confirm the artifact is live (npm publish for CLI; deploy workflow `success` for services). If a merge's own CI run was cancelled by a later push to the same ref, the gate is satisfied by a green run at any descendant commit, verified with `git merge-base --is-ancestor <cancelled-sha> <later-sha>`. A cancelled run with no green descendant run is not verified. Both workflows set `concurrency` with `cancel-in-progress: true` keyed on the ref (`.github/workflows/mx-agent-cli.yml:113-115`, `.github/workflows/coordination-service.yml:83-85`), so a cancelled run is an ordinary result of two merges close together, not a failure.
|
|
96
96
|
3. Save a checkpoint memory. Include PR number, what shipped, deploy status, next step.
|
|
97
97
|
|
|
98
98
|
If the pipeline is still running, wait. If it failed, fix it. Do not start the next iteration with an unverified deploy.
|
|
99
99
|
|
|
100
|
+
<!-- core:read-back -->
|
|
101
|
+
## Tools that fail silently — read back what you wrote
|
|
102
|
+
|
|
103
|
+
`gh` is pinned to 2.97.0 in `.devcontainer/Dockerfile`; older `gh` (Debian's 2.46.0, still present in any devcontainer not rebuilt since) fails on several commands and one of them fails **silently** — affected-command table and substitutes in `mx-agent-system/docs/gh-cli-version-pin.md`. An exit-0 or "created"/"sent" confirmation says the call succeeded, not that the stored content is what you wrote: after any write of a PR body, a comment, or memory content, read it back and compare. Check the read-back is non-empty before you trust its diff: `gh pr view --json body` run from a directory that is not a git repository fails and writes zero bytes, and a diff against an empty file reads as the whole body deleted, which looks like catastrophic drift and is not (found by the #189 engineer, 2026-08-25).
|
|
104
|
+
|
|
100
105
|
<!-- core:continuous-operation -->
|
|
101
106
|
## Continuous operation
|
|
102
107
|
|
|
@@ -73,9 +73,7 @@ mx-agent escalate --to '<team>' --priority '<p0|p1|p2|p3>' --body-file '<path-to
|
|
|
73
73
|
|
|
74
74
|
Check other teams via `{{PRODUCT_SLUG}}-<team>-leader-state` and `{{PRODUCT_SLUG}}-<team>-known-issues` named memories.
|
|
75
75
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
`gh` is pinned to 2.97.0 in `.devcontainer/Dockerfile`; older `gh` (Debian's 2.46.0, still present in any devcontainer not rebuilt since) fails on several commands and one of them fails **silently** — affected-command table and substitutes in `mx-agent-system/docs/gh-cli-version-pin.md`. An exit-0 or "created"/"sent" confirmation says the call succeeded, not that the stored content is what you wrote: after any write of a PR body, a comment, or memory content, read it back and compare.
|
|
76
|
+
{{> core:read-back}}
|
|
79
77
|
|
|
80
78
|
## Instructions that arrive mid-task — the leader channel
|
|
81
79
|
|
|
@@ -29,7 +29,7 @@ lost?**
|
|
|
29
29
|
|
|
30
30
|
| Tier | A fail-open kill means | Size against | Examples |
|
|
31
31
|
|---|---|---|---|
|
|
32
|
-
| **GUARD** | An action the hook exists to prevent is **permitted**. The kill is a bypass primitive: anything that makes the hook slow becomes a way past it. | **Bypass risk.** Be generous — generous enough that only a genuine hang trips it — and bound the hook's own slow calls internally so the hook decides first, on its own fail direction. | `worktree-guard`, `git-mutation-guard`, `mx-guard-hook`, `ci-validate-hook`, `workflow-dispatch-guard`, `named-memory-write-guard`, `gh-pr-edit-guard`, `session-idle-gate` |
|
|
32
|
+
| **GUARD** | An action the hook exists to prevent is **permitted**. The kill is a bypass primitive: anything that makes the hook slow becomes a way past it. | **Bypass risk.** Be generous — generous enough that only a genuine hang trips it — and bound the hook's own slow calls internally so the hook decides first, on its own fail direction. | `worktree-guard`, `git-mutation-guard`, `mx-guard-hook`, `ci-validate-hook`, `workflow-dispatch-guard`, `named-memory-write-guard`, `gh-pr-edit-guard`, `subagent-write-guard`, `session-idle-gate` |
|
|
33
33
|
| **ENFORCED-PROCESS CONTROL** | A **required step is skipped**. No security boundary is crossed, but process discipline the team relies on quietly stops applying. | **False-trip probability.** The risk is not a bypass, it is that a normal slow moment drops the enforcement. Size so ordinary slowness never trips it. | `memory-checkpoint-reminder`, `deploy-verification-reminder` |
|
|
34
34
|
| **ADVISORY** | **Information is lost** and nothing else. No action is permitted, no step is skipped. | Keep it short. A lost reminder or a lost telemetry line is cheap; holding a tool call open is not. | `delegation-audit`, `set-terminal-appearance`, `auto-capture-*`, `auto-checkpoint`, `observability-sync`, `iteration-log-check` |
|
|
35
35
|
|
|
@@ -139,8 +139,34 @@ including the 5s on `set-terminal-appearance`. It never runs on the normal path.
|
|
|
139
139
|
| `reload-checkpoint` | SessionStart | ADVISORY | 20s |
|
|
140
140
|
| `iteration-log-check` | Stop | ADVISORY | 20s |
|
|
141
141
|
| `delegation-audit` | Stop | ADVISORY | 15s |
|
|
142
|
+
| `verify-hooks --check-all` | SessionStart | ADVISORY | 15s |
|
|
142
143
|
| `set-terminal-appearance` | SessionStart | ADVISORY | 5s |
|
|
143
144
|
|
|
145
|
+
`verify-hooks --check-all` is the one row that is not a hook file. It is a CLI
|
|
146
|
+
command the registration runs directly, because a present-but-stale hook file
|
|
147
|
+
never reaches `hook-launcher.sh` and the check must not be a file that can
|
|
148
|
+
itself go stale (#306). Two limits, not one: the inner `timeout 10` is the
|
|
149
|
+
budget the command is measured against (300 ms in criterion 1(d), so 10s is 33x
|
|
150
|
+
headroom), and the outer `timeout: 15` is the fail-open kill. A kill loses one
|
|
151
|
+
staleness report and permits nothing, which is the ADVISORY tier.
|
|
152
|
+
|
|
153
|
+
THE REGISTRATION EXITS 0 ON EVERY PATH, and that is the one place this row
|
|
154
|
+
departs from the exit-code rule two sections above. The rule there governs a
|
|
155
|
+
hook whose message is on STDERR: it exits 1 so the transcript shows the first
|
|
156
|
+
stderr line. This check's whole output is on STDOUT, and a non-zero exit
|
|
157
|
+
suppresses a hook's stdout, so the same exit that makes a stderr message visible
|
|
158
|
+
would make this one disappear. Measured at 583ebf9 (PR #309): with `mx-agent`
|
|
159
|
+
absent the bare command exited 127 with nothing on stdout, and with the
|
|
160
|
+
installed 0.1.72 build it wrote `error: unknown option '--check-all'` to stderr
|
|
161
|
+
and exited 1. Both are states the check exists to report, and in both the
|
|
162
|
+
session saw nothing. The registration is therefore a `bash -c` guard that tests
|
|
163
|
+
for `mx-agent` on PATH, probes `verify-hooks --help` for the option, runs the
|
|
164
|
+
check, and turns every outcome including its own failure to run into exit 0 with
|
|
165
|
+
one line on stdout. The CLI keeps its own codes for anyone calling it directly:
|
|
166
|
+
0 fresh, 2 could-not-compare, 3 stale. Behaviour of the guard string is asserted
|
|
167
|
+
in `session-start-freshness.test.sh`; its exact text is pinned in
|
|
168
|
+
`cli/src/__tests__/config-generation-gate.test.ts`.
|
|
169
|
+
|
|
144
170
|
The two coordination hooks are advisory by tier — being killed loses information
|
|
145
171
|
rather than permitting an action — but the information is cross-team escalation
|
|
146
172
|
delivery, so they are sized and instrumented as if the loss were expensive,
|
|
@@ -29,13 +29,9 @@ Audit of every `|| true` pattern in hook scripts, classifying each by failure im
|
|
|
29
29
|
| `iteration-log-check.sh` | 88 | B | `grep ... \|\| true` | Counting merge commands in transcript; 0 on failure is safe. |
|
|
30
30
|
| `iteration-log-check.sh` | 112, 115 | B | `git rev-parse / jq ... 2>/dev/null \|\| true` | Resolving project slug; empty = use default log name. |
|
|
31
31
|
| `iteration-log-check.sh` | 167 | B | `mx memories get ... 2>/dev/null \|\| true` | Reading iteration log; failure = skip log check (advisory). |
|
|
32
|
-
| `coordination-brief.sh` |
|
|
33
|
-
| `coordination-brief.sh` |
|
|
34
|
-
| `coordination-brief.sh` |
|
|
35
|
-
| `coordination-brief.sh` | 164, 172 | **A** | `az keyvault ... 2>/dev/null \|\| true` | **Token fetch from Azure Key Vault.** Failure means no coordination token; brief will fail silently. Mitigated: the brief itself reports "no token" and the coordination-brief.sh logs to stderr. |
|
|
36
|
-
| `coordination-brief.sh` | 179 | B | `printf ... > "$CACHE" 2>/dev/null \|\| true` | Caching fetched token; loss = re-fetch next time. |
|
|
37
|
-
| `coordination-brief.sh` | 202 | B | `mktemp ... 2>/dev/null \|\| true` | Creating temp file for stderr capture; failure = no stderr capture. |
|
|
38
|
-
| `coordination-brief.sh` | 235 | B | `rm -f ... 2>/dev/null \|\| true` | Cleaning up temp file; standard cleanup. |
|
|
32
|
+
| `coordination-brief.sh` | 150, 151 | B | `mktemp ... 2>/dev/null \|\| true` | Creating the stdout and stderr capture files; failure prints the `no-capture` could-not-run line and the brief then runs unclassified. |
|
|
33
|
+
| `coordination-brief.sh` | 156, 157, 164 | B | `rm -f ... 2>/dev/null \|\| true` | Cleaning up the capture files; standard cleanup. |
|
|
34
|
+
| `coordination-brief.sh` | 161 | B | `mx-agent coordination brief ... \|\| true` | The unclassifiable branch only (mktemp failed). The could-not-run line is printed BEFORE this call, so the branch is never silent. |
|
|
39
35
|
| `deploy-verification-reminder.sh` | 21 | B | `touch ... 2>/dev/null \|\| true` | Touching lock file; failure = cosmetic. |
|
|
40
36
|
| `deploy-verification-reminder.sh` | 64 | B | `>/dev/null 2>&1 \|\| true` | Advisory memory save; non-blocking. |
|
|
41
37
|
| `deploy-verification-reminder.sh` | 74 | B | `touch ... 2>/dev/null \|\| true` | Marking verify-sent; loss = duplicate reminder (harmless). |
|
|
@@ -63,7 +59,11 @@ Audit of every `|| true` pattern in hook scripts, classifying each by failure im
|
|
|
63
59
|
|
|
64
60
|
## Summary
|
|
65
61
|
|
|
66
|
-
- **Class A occurrences:
|
|
62
|
+
- **Class A occurrences: 0.**
|
|
63
|
+
|
|
64
|
+
This entry read "Class A occurrences: 2 (coordination-brief.sh lines 164, 172 — Azure Key Vault token fetch). These already have downstream visibility: the brief command itself reports 'no token' to stderr when the fetch fails." Both halves were wrong by #297. The claim was wrong when written: the branch guarded by those two `|| true` calls was `if [ -z "$fetched" ]; then exit 0; fi`, which printed nothing on any stream, so there was no downstream visibility to rely on. That silence is the defect #291 recorded and #297 fixes. The `az` calls themselves are gone: the hook no longer resolves a token, and the CLI owns the fetch and reports its own failure (`resolveCoordinationToken`, `lib/coordination-token.ts`).
|
|
65
|
+
|
|
66
|
+
Nothing in this file is Class A now, and no `|| true` in `coordination-brief.sh` can produce a silent exit: with the opt-in gate on, every path prints either the brief or one could-not-run line to stdout, pinned by `coordination-brief.test.sh`.
|
|
67
67
|
- **Class B occurrences: all others.** Silent failure is the correct behavior for cosmetic, cleanup, advisory, and parsing-guard patterns.
|
|
68
68
|
|
|
69
69
|
The observability-sync `|| true` that previously lived inline in `settings.json` (line 99) was **Class A** and has been replaced by `observability-sync.sh`, which logs failures to the startup JSONL before exiting 0 (v2.59, #4377).
|
|
@@ -38,13 +38,76 @@ trap 'rm -rf "$tmpdir"; exit 0' EXIT ERR
|
|
|
38
38
|
# Total line count (proxy for session depth)
|
|
39
39
|
_TOTAL_LINES=$(wc -l < "$TRANSCRIPT_PATH" 2>/dev/null || echo "0")
|
|
40
40
|
|
|
41
|
-
#
|
|
42
|
-
|
|
41
|
+
# Subagent transcripts (#5436)
|
|
42
|
+
#
|
|
43
|
+
# A subagent's tool calls are written to its own file, never to the lead's
|
|
44
|
+
# transcript:
|
|
45
|
+
#
|
|
46
|
+
# <project-dir>/<session-id>.jsonl the lead
|
|
47
|
+
# <project-dir>/<session-id>/subagents/agent-*.jsonl one per subagent
|
|
48
|
+
#
|
|
49
|
+
# Subagents made 11,627 of 12,343 repository writes (94%) across 5,713 measured
|
|
50
|
+
# transcripts, so a filter over the lead alone reported "Files modified: None"
|
|
51
|
+
# for most sessions. This hook has no since-last-save window, so every subagent
|
|
52
|
+
# file is in scope. The directory is absent when no subagent ran, which is
|
|
53
|
+
# normal and not an error.
|
|
54
|
+
#
|
|
55
|
+
# SCOPE. Only FILES_MODIFIED and GIT_COMMITS read these files. GIT_PUSHES,
|
|
56
|
+
# PR_CREATES and PR_MERGES below stay lead-only and therefore still undercount.
|
|
57
|
+
# That is deliberate: #5436 scopes this change to file paths and commit counts,
|
|
58
|
+
# and BASH_COMMANDS is the variable those three share, so widening it would
|
|
59
|
+
# change more than the issue asks for. Same one-line pattern when it is wanted.
|
|
60
|
+
#
|
|
61
|
+
# STATED CAP, not a silent one. The largest subagent count in the fleet's 301
|
|
62
|
+
# real sessions is 189, so 200 is above the observed range.
|
|
63
|
+
SUBAGENT_DIR="${TRANSCRIPT_PATH%.jsonl}/subagents"
|
|
64
|
+
SUBAGENT_FILES=()
|
|
65
|
+
if [[ -d "$SUBAGENT_DIR" ]]; then
|
|
66
|
+
while IFS= read -r _mx_f; do
|
|
67
|
+
[[ -n "$_mx_f" ]] && SUBAGENT_FILES+=("$_mx_f")
|
|
68
|
+
done < <(find "$SUBAGENT_DIR" -maxdepth 1 -type f -name 'agent-*.jsonl' 2>/dev/null \
|
|
69
|
+
| head -n "${AUTO_CAPTURE_MAX_SUBAGENTS:-200}")
|
|
70
|
+
fi
|
|
71
|
+
|
|
72
|
+
# `-R` with `fromjson?` skips a malformed line instead of aborting the whole
|
|
73
|
+
# extraction, which matters when reading many files at once. The lead's paths
|
|
74
|
+
# below keep plain `jq -r` and are unchanged.
|
|
75
|
+
SUBAGENT_WRITES=""
|
|
76
|
+
SUBAGENT_BASH=""
|
|
77
|
+
if (( ${#SUBAGENT_FILES[@]} > 0 )); then
|
|
78
|
+
SUBAGENT_WRITES=$(jq -R -r 'fromjson? // empty |
|
|
79
|
+
select(.type == "assistant") |
|
|
80
|
+
.message.content[]? |
|
|
81
|
+
select(.type == "tool_use" and (.name == "Write" or .name == "Edit")) |
|
|
82
|
+
.input.file_path // empty
|
|
83
|
+
' "${SUBAGENT_FILES[@]}" 2>/dev/null || true)
|
|
84
|
+
SUBAGENT_BASH=$(jq -R -r 'fromjson? // empty |
|
|
85
|
+
select(.type == "assistant") |
|
|
86
|
+
.message.content[]? |
|
|
87
|
+
select(.type == "tool_use" and .name == "Bash") |
|
|
88
|
+
.input.command // empty
|
|
89
|
+
' "${SUBAGENT_FILES[@]}" 2>/dev/null || true)
|
|
90
|
+
fi
|
|
91
|
+
|
|
92
|
+
# Files modified (Write/Edit tool calls), by the lead and by its subagents
|
|
93
|
+
LEAD_WRITES=$(jq -r '
|
|
43
94
|
select(.type == "assistant") |
|
|
44
95
|
.message.content[]? |
|
|
45
96
|
select(.type == "tool_use" and (.name == "Write" or .name == "Edit")) |
|
|
46
97
|
.input.file_path // empty
|
|
47
|
-
' "$TRANSCRIPT_PATH" 2>/dev/null | grep -v '^$'
|
|
98
|
+
' "$TRANSCRIPT_PATH" 2>/dev/null | grep -v '^$' || true)
|
|
99
|
+
|
|
100
|
+
_MX_ALL_WRITES=$(printf '%s\n%s\n' "$LEAD_WRITES" "$SUBAGENT_WRITES" \
|
|
101
|
+
| grep -v '^$' | sort -u)
|
|
102
|
+
|
|
103
|
+
# Repository paths first, scratchpad paths after, one shared cap of 30. A fifth
|
|
104
|
+
# of subagent writes target a scratchpad under /tmp, and "/tmp" sorts ahead of
|
|
105
|
+
# "/workspace", so a plain sort would fill the list with temporary files and
|
|
106
|
+
# drop the repository paths this field exists to name. Nothing new is captured;
|
|
107
|
+
# one list is reordered and the cap is the same 30 as before.
|
|
108
|
+
FILES_MODIFIED=$( { printf '%s\n' "$_MX_ALL_WRITES" | grep -v '^/tmp/' || true; \
|
|
109
|
+
printf '%s\n' "$_MX_ALL_WRITES" | grep '^/tmp/' || true; } \
|
|
110
|
+
| grep -v '^$' | head -30)
|
|
48
111
|
|
|
49
112
|
# Files read (Read tool calls — indicates areas of investigation)
|
|
50
113
|
FILES_READ=$(jq -r '
|
|
@@ -63,7 +126,14 @@ BASH_COMMANDS=$(jq -r '
|
|
|
63
126
|
' "$TRANSCRIPT_PATH" 2>/dev/null | grep -v '^$' | grep -vE '^(ls|pwd|echo|cat |head |tail )' | tail -20)
|
|
64
127
|
|
|
65
128
|
# Git activity
|
|
66
|
-
|
|
129
|
+
# Commit count over the lead and its subagents (#5436). Committing is usually
|
|
130
|
+
# delegated, so the lead-only count read 0 for most sessions. SUBAGENT_BASH is
|
|
131
|
+
# counted and never saved: no command text from it reaches the memory.
|
|
132
|
+
GIT_COMMITS_LEAD=$(echo "$BASH_COMMANDS" | grep -oE 'git commit' | wc -l | tr -d ' ')
|
|
133
|
+
GIT_COMMITS_SUB=$(printf '%s\n' "$SUBAGENT_BASH" | grep -oE 'git commit' | wc -l | tr -d ' ')
|
|
134
|
+
[[ "$GIT_COMMITS_LEAD" =~ ^[0-9]+$ ]] || GIT_COMMITS_LEAD=0
|
|
135
|
+
[[ "$GIT_COMMITS_SUB" =~ ^[0-9]+$ ]] || GIT_COMMITS_SUB=0
|
|
136
|
+
GIT_COMMITS=$(( GIT_COMMITS_LEAD + GIT_COMMITS_SUB ))
|
|
67
137
|
GIT_PUSHES=$(echo "$BASH_COMMANDS" | grep -oE 'git push' | wc -l | tr -d ' ')
|
|
68
138
|
PR_CREATES=$(echo "$BASH_COMMANDS" | grep -oE 'gh pr create' | wc -l | tr -d ' ')
|
|
69
139
|
PR_MERGES=$(echo "$BASH_COMMANDS" | grep -oE 'gh pr merge' | wc -l | tr -d ' ')
|
|
@@ -161,14 +231,99 @@ MemNexus. Reconstruct context from the files, activity and references above."
|
|
|
161
231
|
# Truncate total content
|
|
162
232
|
CONTENT=$(echo "$CONTENT" | head -c 6000)
|
|
163
233
|
|
|
164
|
-
# ──
|
|
234
|
+
# ── 5. Verbatim-transcript guard (fail-closed, fail-loud) ───────────────
|
|
235
|
+
#
|
|
236
|
+
# SCOPE — TEXT BLOCKS ONLY. This guard re-extracts
|
|
237
|
+
# `.message.content[] | select(.type == "text")`, the same selector the removed
|
|
238
|
+
# capture used, and refuses the save if any of that prose reached $CONTENT. It
|
|
239
|
+
# does NOT re-extract tool_use inputs, tool_result content, or thinking blocks.
|
|
240
|
+
# It is therefore NOT a general backstop against transcript material reaching
|
|
241
|
+
# MemNexus — it enforces one specific removal. Material captured from any other
|
|
242
|
+
# part of the transcript passes it untouched, by design.
|
|
243
|
+
#
|
|
244
|
+
# It is NOT a redactor either. A keyword redactor cannot catch prose that
|
|
245
|
+
# restates a secret in a sentence, which is exactly the shape this hook was
|
|
246
|
+
# leaking, so the capture was removed and this verifies the removal held.
|
|
247
|
+
#
|
|
248
|
+
# If the check itself cannot run, it refuses too. A save never proceeds
|
|
249
|
+
# unverified, and every refusal is announced on stderr.
|
|
250
|
+
# Returns 0 = safe to save, 1 = do not save.
|
|
251
|
+
mx_verbatim_guard() {
|
|
252
|
+
local transcript="$1" content="$2" prose pat
|
|
253
|
+
local tag="[auto-capture-precompact] BLOCKED: memory NOT saved —"
|
|
254
|
+
|
|
255
|
+
if ! command -v jq >/dev/null 2>&1; then
|
|
256
|
+
echo "$tag jq unavailable, cannot verify transcript text was excluded" >&2
|
|
257
|
+
return 1
|
|
258
|
+
fi
|
|
259
|
+
if [[ ! -r "$transcript" ]]; then
|
|
260
|
+
echo "$tag transcript unreadable, cannot verify" >&2
|
|
261
|
+
return 1
|
|
262
|
+
fi
|
|
263
|
+
|
|
264
|
+
prose=$(mktemp) || { echo "$tag mktemp failed, cannot verify" >&2; return 1; }
|
|
265
|
+
pat=$(mktemp) || { rm -f "$prose"; echo "$tag mktemp failed, cannot verify" >&2; return 1; }
|
|
266
|
+
|
|
267
|
+
# `-R` + `fromjson?` parses each JSONL line independently: a malformed line is
|
|
268
|
+
# skipped rather than aborting the extraction. Parity holds for the PROSE path
|
|
269
|
+
# by construction — GH_REFS above uses this identical parser, so a line this
|
|
270
|
+
# guard skips is a line the prose/reference capture skipped too. The claim is
|
|
271
|
+
# limited to that path: FILES_MODIFIED, FILES_READ, BASH_COMMANDS,
|
|
272
|
+
# TOOL_SUMMARY and TOOL_COUNT (lines 42-100) use plain `jq -r`, a
|
|
273
|
+
# different mode that aborts on a malformed line instead of skipping it. Those
|
|
274
|
+
# extract no text blocks, so they fall outside what this guard checks anyway.
|
|
275
|
+
if ! jq -R -r 'fromjson? // empty |
|
|
276
|
+
select(.type == "user" or .type == "assistant") |
|
|
277
|
+
.message.content |
|
|
278
|
+
if type == "array" then [.[] | select(.type == "text") | .text // empty] | join("\n")
|
|
279
|
+
elif type == "string" then .
|
|
280
|
+
else empty end' "$transcript" > "$prose" 2>/dev/null; then
|
|
281
|
+
rm -f "$prose" "$pat"
|
|
282
|
+
echo "$tag transcript prose extraction failed, cannot verify" >&2
|
|
283
|
+
return 1
|
|
284
|
+
fi
|
|
285
|
+
|
|
286
|
+
# Candidate prose lines: long enough and sentence-shaped. Short structured
|
|
287
|
+
# tokens (a `#4804` reference, a bare file path) are deliberately captured and
|
|
288
|
+
# are not free text, so they are not candidates.
|
|
289
|
+
awk 'length($0) >= 40 && index($0, " ") > 0' "$prose" | head -5000 > "$pat"
|
|
290
|
+
|
|
291
|
+
if [[ -s "$pat" ]] && grep -F -q -f "$pat" <<< "$content"; then
|
|
292
|
+
rm -f "$prose" "$pat"
|
|
293
|
+
echo "$tag assembled content still contains verbatim transcript prose" >&2
|
|
294
|
+
return 1
|
|
295
|
+
fi
|
|
296
|
+
|
|
297
|
+
rm -f "$prose" "$pat"
|
|
298
|
+
return 0
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
# ── 5b. Resolve project scope (codeContext) ──────────────────────────────
|
|
302
|
+
#
|
|
303
|
+
# BACKPORT. The block below is the "Resolve project scope" block of
|
|
304
|
+
# @memnexus-ai/cli@1.7.235, hooks/capture-precompact.sh lines 204 to 459, copied byte
|
|
305
|
+
# for byte apart from the three points this note names. Product owner ruling,
|
|
306
|
+
# 2026-08-22 (AskUserQuestion): "Approve both halves in v5" (plan #67, fixes #62).
|
|
307
|
+
#
|
|
308
|
+
# WHERE THIS FORK DIFFERS FROM UPSTREAM:
|
|
309
|
+
# 1. Section number. Upstream numbers the block 6b. This file's guard is
|
|
310
|
+
# section 5 and its save is section 6, so the block is 5b here. Its
|
|
311
|
+
# position is the same: after the content is built, before the create call.
|
|
312
|
+
# 2. The trap paragraph below names section 2, which is where THIS file arms
|
|
313
|
+
# `trap 'rm -rf "$tmpdir"; exit 0' EXIT ERR`.
|
|
314
|
+
# Upstream names its own section 4.
|
|
315
|
+
# 3. The create call keeps this fork's `timeout "${AUTO_CAPTURE_TIMEOUT_SECS:-20}"` and
|
|
316
|
+
# `|| true`, not upstream's TIMEOUT_CMD and CREATE_STATUS reporting. The one
|
|
317
|
+
# addition is the --code-context argument.
|
|
318
|
+
#
|
|
319
|
+
# auto-checkpoint.sh gets none of this. It writes a NAMED memory, and scope must
|
|
320
|
+
# not reach that path until memnexus#5470 is resolved (#62).
|
|
321
|
+
#
|
|
322
|
+
# ── upstream block, verbatim from here ──
|
|
165
323
|
# Auto-captured memories carried no scope at all, so they leaked into every
|
|
166
324
|
# team's scoped searches and polluted build_context (#5158, #4957). PR #3281
|
|
167
325
|
# fixed that for the commit path only; this is the same resolution for the
|
|
168
|
-
# capture hooks, using the same sources and the same precedence.
|
|
169
|
-
# the reviewed customer hook cli/hooks/capture-precompact.sh — port from that
|
|
170
|
-
# file's FINAL state, not from an earlier draft: two of the properties below
|
|
171
|
-
# were blocking security findings.
|
|
326
|
+
# capture hooks, using the same sources and the same precedence.
|
|
172
327
|
#
|
|
173
328
|
# Mirrors resolveCommitCodeContext() in cli/src/lib/commit-context/code-context.ts:
|
|
174
329
|
# 1. MX_CODE_CONTEXT env var — operator-controlled, higher trust. It wins over
|
|
@@ -191,8 +346,6 @@ CODE_CONTEXT_MAX_BYTES=65536
|
|
|
191
346
|
# cli/src/lib/commit-context/local-cache.ts. `-e`, not `-d`: inside a git
|
|
192
347
|
# worktree `.git` is a FILE, and the worktree root — not the main repo — is the
|
|
193
348
|
# project root (the TS uses fs.existsSync, which makes no such distinction).
|
|
194
|
-
# In the fleet this is the ONLY case that occurs: every agent works in a
|
|
195
|
-
# worktree, so `-d` would silently resolve no scope on every machine.
|
|
196
349
|
find_project_root() { # <start-dir> -> project root on stdout, or nothing
|
|
197
350
|
local dir
|
|
198
351
|
dir=$(cd "$1" 2>/dev/null && pwd -P) || return 0
|
|
@@ -232,7 +385,7 @@ find_project_root() { # <start-dir> -> project root on stdout, or nothing
|
|
|
232
385
|
# exceeds 2 UTF-16 units, 100 codepoints can never exceed 200 units. Scope
|
|
233
386
|
# labels are short names (product/team/service); the extra truncation is
|
|
234
387
|
# unreachable in practice, and truncating is recoverable where a rejected
|
|
235
|
-
# request is not.
|
|
388
|
+
# request is not.
|
|
236
389
|
normalize_code_context() { # JSON on stdin -> normalized JSON object, or nothing
|
|
237
390
|
local out
|
|
238
391
|
out=$(jq -s -c '
|
|
@@ -277,6 +430,15 @@ if [[ -z "$CODE_CONTEXT_JSON" ]]; then
|
|
|
277
430
|
# {"product":"home","team":"DOTFILES-WRONG-SCOPE"} from the $HOME config.
|
|
278
431
|
# The loop below consults the next source instead, which `:-` cannot express.
|
|
279
432
|
#
|
|
433
|
+
# WHAT IS ACTUALLY KNOWN ABOUT CLAUDE_PROJECT_DIR IN THE CUSTOMER CONTEXT.
|
|
434
|
+
# It is the documented hook variable, and it is the right first source when it
|
|
435
|
+
# is present. This repo does NOT evidence that it is set for hooks installed
|
|
436
|
+
# by `mx mcp install`: every other reference to it is fleet code, and it was
|
|
437
|
+
# measured UNSET in a live Claude Code tool process (a tool process is not a
|
|
438
|
+
# hook process, so that is not disproof — but it is not confirmation either).
|
|
439
|
+
# The expression below is therefore designed to be CORRECT WHEN IT IS ABSENT:
|
|
440
|
+
# an unset or empty value is skipped by the loop and the cwd carries the case.
|
|
441
|
+
# Do not restructure this so that a present CLAUDE_PROJECT_DIR is required.
|
|
280
442
|
# WHY THE TRANSCRIPT DIRECTORY IS NOT A SOURCE. It has no legitimate resolving
|
|
281
443
|
# power, and the reason is DEPTH-INDEPENDENT — do not restate it as a claim
|
|
282
444
|
# about the transcript's nesting. An earlier version of this comment argued
|
|
@@ -369,10 +531,12 @@ if [[ -z "$CODE_CONTEXT_JSON" ]]; then
|
|
|
369
531
|
CC_FILE="${CC_ROOT}/.mx-code-context.json"
|
|
370
532
|
if [[ -n "$CC_ROOT" ]]; then
|
|
371
533
|
# CWE-59. `-f`, `-r` and the read all follow symlinks, so a repo could check
|
|
372
|
-
# in `.mx-code-context.json` as a symlink to any file on the machine
|
|
373
|
-
# six allowlisted keys of it would be uploaded to
|
|
374
|
-
# and require the result to stay inside
|
|
375
|
-
#
|
|
534
|
+
# in `.mx-code-context.json` as a symlink to any file on the user's machine
|
|
535
|
+
# and the six allowlisted keys of it would be uploaded to the user's own
|
|
536
|
+
# MemNexus account. Resolve the path and require the result to stay inside
|
|
537
|
+
# the project root — the containment this same hook already applies to the
|
|
538
|
+
# transcript path earlier. Read through the RESOLVED path, so the link is
|
|
539
|
+
# not traversed a second time.
|
|
376
540
|
CC_REAL=$(realpath "$CC_FILE" 2>/dev/null || printf '')
|
|
377
541
|
if [[ -n "$CC_REAL" && "$CC_REAL" == "$CC_ROOT"/* && -f "$CC_REAL" && -r "$CC_REAL" ]]; then
|
|
378
542
|
# One open, bounded at the source (same 64KB bound as the TS resolver).
|
|
@@ -412,73 +576,6 @@ if [[ -n "$CODE_CONTEXT_JSON" ]]; then
|
|
|
412
576
|
CODE_CONTEXT_ARGS=(--code-context "$CODE_CONTEXT_JSON")
|
|
413
577
|
fi
|
|
414
578
|
|
|
415
|
-
# ── 5. Verbatim-transcript guard (fail-closed, fail-loud) ───────────────
|
|
416
|
-
#
|
|
417
|
-
# SCOPE — TEXT BLOCKS ONLY. This guard re-extracts
|
|
418
|
-
# `.message.content[] | select(.type == "text")`, the same selector the removed
|
|
419
|
-
# capture used, and refuses the save if any of that prose reached $CONTENT. It
|
|
420
|
-
# does NOT re-extract tool_use inputs, tool_result content, or thinking blocks.
|
|
421
|
-
# It is therefore NOT a general backstop against transcript material reaching
|
|
422
|
-
# MemNexus — it enforces one specific removal. Material captured from any other
|
|
423
|
-
# part of the transcript passes it untouched, by design.
|
|
424
|
-
#
|
|
425
|
-
# It is NOT a redactor either. A keyword redactor cannot catch prose that
|
|
426
|
-
# restates a secret in a sentence, which is exactly the shape this hook was
|
|
427
|
-
# leaking, so the capture was removed and this verifies the removal held.
|
|
428
|
-
#
|
|
429
|
-
# If the check itself cannot run, it refuses too. A save never proceeds
|
|
430
|
-
# unverified, and every refusal is announced on stderr.
|
|
431
|
-
# Returns 0 = safe to save, 1 = do not save.
|
|
432
|
-
mx_verbatim_guard() {
|
|
433
|
-
local transcript="$1" content="$2" prose pat
|
|
434
|
-
local tag="[auto-capture-precompact] BLOCKED: memory NOT saved —"
|
|
435
|
-
|
|
436
|
-
if ! command -v jq >/dev/null 2>&1; then
|
|
437
|
-
echo "$tag jq unavailable, cannot verify transcript text was excluded" >&2
|
|
438
|
-
return 1
|
|
439
|
-
fi
|
|
440
|
-
if [[ ! -r "$transcript" ]]; then
|
|
441
|
-
echo "$tag transcript unreadable, cannot verify" >&2
|
|
442
|
-
return 1
|
|
443
|
-
fi
|
|
444
|
-
|
|
445
|
-
prose=$(mktemp) || { echo "$tag mktemp failed, cannot verify" >&2; return 1; }
|
|
446
|
-
pat=$(mktemp) || { rm -f "$prose"; echo "$tag mktemp failed, cannot verify" >&2; return 1; }
|
|
447
|
-
|
|
448
|
-
# `-R` + `fromjson?` parses each JSONL line independently: a malformed line is
|
|
449
|
-
# skipped rather than aborting the extraction. Parity holds for the PROSE path
|
|
450
|
-
# by construction — GH_REFS above uses this identical parser, so a line this
|
|
451
|
-
# guard skips is a line the prose/reference capture skipped too. The claim is
|
|
452
|
-
# limited to that path: FILES_MODIFIED, FILES_READ, BASH_COMMANDS,
|
|
453
|
-
# TOOL_SUMMARY and TOOL_COUNT (lines 42-100) use plain `jq -r`, a
|
|
454
|
-
# different mode that aborts on a malformed line instead of skipping it. Those
|
|
455
|
-
# extract no text blocks, so they fall outside what this guard checks anyway.
|
|
456
|
-
if ! jq -R -r 'fromjson? // empty |
|
|
457
|
-
select(.type == "user" or .type == "assistant") |
|
|
458
|
-
.message.content |
|
|
459
|
-
if type == "array" then [.[] | select(.type == "text") | .text // empty] | join("\n")
|
|
460
|
-
elif type == "string" then .
|
|
461
|
-
else empty end' "$transcript" > "$prose" 2>/dev/null; then
|
|
462
|
-
rm -f "$prose" "$pat"
|
|
463
|
-
echo "$tag transcript prose extraction failed, cannot verify" >&2
|
|
464
|
-
return 1
|
|
465
|
-
fi
|
|
466
|
-
|
|
467
|
-
# Candidate prose lines: long enough and sentence-shaped. Short structured
|
|
468
|
-
# tokens (a `#4804` reference, a bare file path) are deliberately captured and
|
|
469
|
-
# are not free text, so they are not candidates.
|
|
470
|
-
awk 'length($0) >= 40 && index($0, " ") > 0' "$prose" | head -5000 > "$pat"
|
|
471
|
-
|
|
472
|
-
if [[ -s "$pat" ]] && grep -F -q -f "$pat" <<< "$content"; then
|
|
473
|
-
rm -f "$prose" "$pat"
|
|
474
|
-
echo "$tag assembled content still contains verbatim transcript prose" >&2
|
|
475
|
-
return 1
|
|
476
|
-
fi
|
|
477
|
-
|
|
478
|
-
rm -f "$prose" "$pat"
|
|
479
|
-
return 0
|
|
480
|
-
}
|
|
481
|
-
|
|
482
579
|
# ── 6. Save memory ──────────────────────────────────────────────────────
|
|
483
580
|
if mx_verbatim_guard "$TRANSCRIPT_PATH" "$CONTENT"; then
|
|
484
581
|
# Bounded: network write. On timeout we land on the existing `|| true` path —
|