@memnexus-ai/mx-agent-cli 0.1.294-next.0 → 0.1.295-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__/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 +35 -0
- 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 +227 -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 +1230 -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 +11 -11
- 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__/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__/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 +3095 -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__/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.js +23 -1
- package/dist/__tests__/standards-injection.test.js.map +1 -1
- 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 +279 -0
- package/dist/agent-config/hooks/auto-capture-session-end.sh +277 -0
- 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/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.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 +519 -25
- package/dist/commands/coordination.js.map +1 -1
- package/dist/commands/create.d.ts +913 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +4879 -345
- package/dist/commands/create.js.map +1 -1
- 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/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/session.js +1 -1
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/start.d.ts +38 -0
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +171 -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/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 +122 -11
- package/dist/index.js.map +1 -1
- package/dist/lib/agent-session.d.ts.map +1 -1
- package/dist/lib/agent-session.js +6 -1
- package/dist/lib/agent-session.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 +53 -23
- package/dist/lib/claude.d.ts.map +1 -1
- package/dist/lib/claude.js +306 -17
- 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 +73 -0
- package/dist/lib/coordination-client.d.ts.map +1 -1
- package/dist/lib/coordination-client.js +180 -8
- package/dist/lib/coordination-client.js.map +1 -1
- package/dist/lib/coordination-token.d.ts +304 -6
- package/dist/lib/coordination-token.d.ts.map +1 -1
- package/dist/lib/coordination-token.js +851 -52
- package/dist/lib/coordination-token.js.map +1 -1
- 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/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/roster.d.ts +87 -0
- package/dist/lib/roster.d.ts.map +1 -0
- package/dist/lib/roster.js +332 -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 +10 -1
- package/dist/lib/standards.d.ts.map +1 -1
- package/dist/lib/standards.js +8 -1
- package/dist/lib/standards.js.map +1 -1
- 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/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 +8 -0
- package/dist/standards/po-communication-standard.md +126 -0
- package/dist/standards/report-format.md +8 -0
- package/dist/standards/writing-standard.md +146 -4
- package/package.json +1 -1
- package/scripts/generate-claude.mjs +119 -46
|
@@ -24,9 +24,9 @@ grep -c "—" docs/legibility-plan.md .mx-agent/goals.md .mx-agent/lessons.md \
|
|
|
24
24
|
|
|
25
25
|
Run on 2026-08-18 at commit `817a4ef`.
|
|
26
26
|
|
|
27
|
-
A rule nobody applies twice is an opinion. `product/mx-agent-prd.md:268
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
A rule nobody applies twice is an opinion. `product/mx-agent-prd.md:268`, "When we built a
|
|
28
|
+
mechanism, teams followed the practice", records the pattern, and adds that teams stopped
|
|
29
|
+
when we only wrote a rule. So this file is injected rather than filed.
|
|
30
30
|
|
|
31
31
|
---
|
|
32
32
|
|
|
@@ -65,7 +65,8 @@ it never stands in for one.
|
|
|
65
65
|
**9. Every figure states a referenceable source.** A number publishes with the command, the
|
|
66
66
|
file and line, or the query that produced it. Eight figures in this repository were correct
|
|
67
67
|
against the wrong thing in one week, and the source line is what made them findable.
|
|
68
|
-
See `.mx-agent/lessons.md` L2.
|
|
68
|
+
See `.mx-agent/lessons.md` L2. Rule 15 states the form any cross-file citation takes, and
|
|
69
|
+
it adds to this rule rather than relaxing it.
|
|
69
70
|
|
|
70
71
|
**10. No weasel words.** Ban `essentially`, `arguably`, `fairly`, `quite`, `somewhat`,
|
|
71
72
|
`it seems`, `it appears`, `in some sense`, `a number of`. State the claim, or state the
|
|
@@ -85,6 +86,26 @@ sentence over 25 words is usually two sentences.
|
|
|
85
86
|
results. Collapsing the third into either of the others is the defect in
|
|
86
87
|
`mx-agent-system/standards/fail-loud-standard.md`.
|
|
87
88
|
|
|
89
|
+
**15. A stale line citation still resolves.** It points at other content, and the reader
|
|
90
|
+
gets no signal. A citation names four things: the file, the line, an anchor, and the tree it
|
|
91
|
+
resolved against. The anchor is a heading or a short quoted phrase. The tree is a commit
|
|
92
|
+
SHA, or a branch name with the SHA or the date beside it. State it once per citation or once
|
|
93
|
+
per document. A branch name alone names no tree, because the branch moves.
|
|
94
|
+
`` `product/mx-agent-prd.md:1091`, "bootstrap also owns the shared framework core", resolved
|
|
95
|
+
against `origin/main` at `5d2bdb8` ``. Write every part, never fewer. A citation you quote
|
|
96
|
+
as an example, or list in a resolution record, names the file and the line only. A citation
|
|
97
|
+
that supports a claim names all four. A bare `` `:629` `` names no file and can pick up the
|
|
98
|
+
wrong one. The anchor is the text at the cited line. When the two disagree the anchor is
|
|
99
|
+
authoritative: re-resolve it and update the line, except inside a record. State the tree
|
|
100
|
+
only if you resolved the citation against it. A reviewer states the tree the review ran
|
|
101
|
+
against. Code is the exception: `file:line` stays, re-derived when you write it. Records are
|
|
102
|
+
dev-logs, outcome records, interview notes and merge comments. A memory is a record when it
|
|
103
|
+
states what was true at a time rather than what is true now. Never repair a citation inside
|
|
104
|
+
one, which would make the record claim an accuracy it did not have. Leave the original and
|
|
105
|
+
add a dated correction beside it. A new citation written into a record follows this rule in
|
|
106
|
+
full. This rule makes staleness loud rather than absent, and no check verifies that a
|
|
107
|
+
citation supports its claim.
|
|
108
|
+
|
|
88
109
|
<!-- behavioral-end -->
|
|
89
110
|
|
|
90
111
|
---
|
|
@@ -94,6 +115,15 @@ results. Collapsing the third into either of the others is the defect in
|
|
|
94
115
|
Each pair below is a real commit on `docs/mx-agent-prd`. The rule is abstract and the
|
|
95
116
|
correction is not, so read these first.
|
|
96
117
|
|
|
118
|
+
Rule 15 applies to this document, so here is what was resolved rather than a blanket claim.
|
|
119
|
+
Product resolved these against `origin/main` at `5d2bdb8` on 2026-09-02: the two
|
|
120
|
+
`product/mx-agent-prd.md` citations at `:268` and `:1091`, the `:609` and `:639` pair below,
|
|
121
|
+
`product-leader.md:323` with `product/mx-agent-prd.md:1004`, and the four
|
|
122
|
+
`team-builder.md` and `create.ts` citations. Bootstrap resolved its own figures against
|
|
123
|
+
`HEAD` at `49fa76d`, which is bootstrap's measurement and not product's. The
|
|
124
|
+
`mx-agent-system/cli/src/lib/jsonl.ts` pair below names a form and no line, so nothing there
|
|
125
|
+
resolves.
|
|
126
|
+
|
|
97
127
|
### Rule 3, possession verbs
|
|
98
128
|
|
|
99
129
|
| | |
|
|
@@ -210,6 +240,118 @@ The real figure is 2.26 GB. A write count inflated fivefold because a regex coun
|
|
|
210
240
|
Both were found by re-running the command next to the number. Neither was findable from the
|
|
211
241
|
number alone. `.mx-agent/lessons.md` L2 holds the full list.
|
|
212
242
|
|
|
243
|
+
### Rule 15, a stale line citation still resolves
|
|
244
|
+
|
|
245
|
+
One edit to `product/mx-agent-prd.md` in PR #331 invalidated at least 88 `file:line`
|
|
246
|
+
citations across at least 16 live files and all four teams. Repository-wide, at least 54
|
|
247
|
+
files hold at least 166 citations into that one document, and at least 118 of the 130
|
|
248
|
+
distinct ones went stale. The product team measured this and caused it; issue #343 holds the
|
|
249
|
+
method and the reproduction.
|
|
250
|
+
|
|
251
|
+
Every figure above is a floor rather than a count. The search used one pattern, which
|
|
252
|
+
matches a citation naming its file. Gateway found a second form that names the file through
|
|
253
|
+
an earlier citation in the same paragraph, as a bare `` `:609` ``. That form occurs 108
|
|
254
|
+
times in `mx-agent-system/`, `product/` and `docs/`, and the first pattern did not see any
|
|
255
|
+
of them.
|
|
256
|
+
|
|
257
|
+
```sh
|
|
258
|
+
grep -rnE '`:[0-9]+' --include=*.md mx-agent-system/ product/ docs/ | wc -l # 108
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Resolved against `origin/main` at `5d2bdb8` on 2026-09-02. This document adds seven matching
|
|
262
|
+
lines of its own, and the same command returns 115 in the working tree that produced this
|
|
263
|
+
paragraph. The command counts lines rather than occurrences, so the seven lines it counts
|
|
264
|
+
hold ten citations. State the limit of a method next to the number it produced, which is rule 9
|
|
265
|
+
applied to the measurement itself.
|
|
266
|
+
|
|
267
|
+
| | |
|
|
268
|
+
|---|---|
|
|
269
|
+
| Before | the same-function rule is at `product/mx-agent-prd.md:609` |
|
|
270
|
+
| After | the same-function rule is at `` `product/mx-agent-prd.md:639`, "An answer a command already computes is rendered from that same function" `` |
|
|
271
|
+
| Source | issue #343, resolved against `origin/main` at `5d2bdb8` on 2026-09-02 |
|
|
272
|
+
|
|
273
|
+
The before line still resolves. After the edit, `:609` holds a paragraph about Electron
|
|
274
|
+
install size and renderer sandboxing, which is real and plausible content, and five files
|
|
275
|
+
cited `:609` as the standing architecture constraint
|
|
276
|
+
(`git grep -lE 'mx-agent-prd\.md:609' 5d2bdb8 -- '*.md'`). A dead link returns an error and
|
|
277
|
+
a stale line citation returns prose.
|
|
278
|
+
|
|
279
|
+
That figure of five went stale during this document's own security review. PR #340 repaired
|
|
280
|
+
three of the files, and the same command returns 2 at `origin/main`, which was `1f510eb` at
|
|
281
|
+
that point. The original sentence stands because it names its tree. The two that remain are
|
|
282
|
+
a dev-log and a set of draft notes, which rule 15 tells nobody to repair.
|
|
283
|
+
|
|
284
|
+
| | |
|
|
285
|
+
|---|---|
|
|
286
|
+
| Before | an approved roleguide correction cites two lines of `mx-agent-system/cli/src/lib/jsonl.ts` |
|
|
287
|
+
| After | the same two citations, plus "resolved against `origin/main` at `<sha>`, `<time>`" |
|
|
288
|
+
| Source | gateway, in coordination with bootstrap and product, 2026-09-02. PR #325 added 1,757 lines, 467 of them in `jsonl.ts` (`gh pr view 325 --json additions,files`, run 2026-09-02) |
|
|
289
|
+
|
|
290
|
+
The citations keep their line numbers because they name code. Gateway gave the reason: a
|
|
291
|
+
reader opens a source file in an editor that jumps to a line, and one expression can appear
|
|
292
|
+
many times in one file, so a quoted expression locates nothing. An edit shifts prose as a
|
|
293
|
+
block and a code citation names one expression, which is the distinction the rule draws.
|
|
294
|
+
|
|
295
|
+
PR #325 merged hours after that review approved the citations. Gateway stated the general
|
|
296
|
+
case: a review is valid against the tree it was performed on, and nothing in the artifact
|
|
297
|
+
records which tree that was. Bootstrap and product then resolved the same citation to two
|
|
298
|
+
different line numbers on the same day, because bootstrap held unpushed work. Neither team
|
|
299
|
+
was wrong, and the artifact could not say so.
|
|
300
|
+
|
|
301
|
+
| | |
|
|
302
|
+
|---|---|
|
|
303
|
+
| Before | a dev-log cites `product/mx-agent-prd.md:609`, and someone repairs it to `:639` |
|
|
304
|
+
| After | the dev-log keeps `:609`, unchanged |
|
|
305
|
+
| Source | bootstrap's exclusion, adopted in issue #343 |
|
|
306
|
+
|
|
307
|
+
The repair looks like maintenance and falsifies the record. A dev-log states what its author
|
|
308
|
+
resolved at the time. Rule 15 prohibits the repair rather than exempting the record.
|
|
309
|
+
|
|
310
|
+
The strongest case for reaching templates is bootstrap's, and product did not reproduce it.
|
|
311
|
+
Bootstrap resolved `mx-agent-system/templates/roleguide-skeleton.md` and
|
|
312
|
+
`mx-agent-system/roleguides/team-builder.md` against `HEAD` at `49fa76d` on
|
|
313
|
+
2026-09-02T11:38Z. The skeleton holds zero `file:line` citations. `team-builder.md` holds
|
|
314
|
+
four, of which one is stale: `` `team-builder.md:365`, "the write opens" `` cites
|
|
315
|
+
`create.ts:1367-1376` for a file open, that range now holds CRLF normalisation code, and the
|
|
316
|
+
open is at `create.ts:283`. One of the other three is worse than a stale document citation.
|
|
317
|
+
It is inside a template block at `` `team-builder.md:783`, "Named memories cap near 2000
|
|
318
|
+
words" `` that provisioning writes verbatim into every new team's iteration-log memory
|
|
319
|
+
content. It resolves today. When it drifts, it reaches every team
|
|
320
|
+
created after that, and nothing in a memory prompts a reader to re-resolve it. A stale
|
|
321
|
+
citation in a document is read by whoever opens the document. A stale citation in a template
|
|
322
|
+
is copied.
|
|
323
|
+
|
|
324
|
+
### Rule 15, why the rule states a form rather than asking people to look
|
|
325
|
+
|
|
326
|
+
Product counted 46 stale citations in surface-owned files. Surface fixed 3 of them on the
|
|
327
|
+
day the problem was raised, which is 6.5%, while a surface engineer was actively working on
|
|
328
|
+
this problem (issue #350, PRs #340 and #341). A rule that depends on someone looking is not
|
|
329
|
+
a control, and that figure is the whole argument for stating a form instead.
|
|
330
|
+
|
|
331
|
+
Surface then repointed 34 citations across 8 files in PR #348 and reported five failure
|
|
332
|
+
modes (`gh pr view 348 --json title,files`, run 2026-09-02). Three of them are quotations
|
|
333
|
+
that are accurate and still do not resolve: a quote that runs past a bold span, a quote
|
|
334
|
+
containing an ellipsis, and a quote that tidies a path in the source. Accuracy and
|
|
335
|
+
resolvability are different properties.
|
|
336
|
+
|
|
337
|
+
### Rule 15, what the rule does not do
|
|
338
|
+
|
|
339
|
+
A quoted phrase resolves only until someone rewords it. Surface asked for this limit to be
|
|
340
|
+
stated so that nobody expects more from the rule than it gives.
|
|
341
|
+
|
|
342
|
+
A check resolves a citation and cannot verify that the citation supports the claim.
|
|
343
|
+
Product's own roleguide holds the example.
|
|
344
|
+
`mx-agent-system/roleguides/product-leader.md:323`, "Build-list components with a
|
|
345
|
+
first-release disposition", cites `product/mx-agent-prd.md:1004` for the count 0 of 23. That
|
|
346
|
+
line exists and holds a component-state table row about a self-measurement harness. The
|
|
347
|
+
phrase "first-release disposition" appears zero times in the cited document, and so does "0
|
|
348
|
+
of 23" (`grep -c "first-release disposition" product/mx-agent-prd.md`, run 2026-09-02
|
|
349
|
+
against `origin/main` at `5d2bdb8`). This example is preserved as it stood at that tree, and
|
|
350
|
+
nobody updates it when the citation is repaired. The citation resolves, and the claim it
|
|
351
|
+
supports appears nowhere in what it cites. A checker built on rule 15 passes it. Resolving a
|
|
352
|
+
citation and verifying that it supports a claim are two checks, and only the first one is
|
|
353
|
+
mechanisable.
|
|
354
|
+
|
|
213
355
|
---
|
|
214
356
|
|
|
215
357
|
## How to apply rule 2 in one step
|
package/package.json
CHANGED
|
@@ -54,6 +54,17 @@
|
|
|
54
54
|
* previewed by a normal session start — run the generator directly against the
|
|
55
55
|
* working tree (no `--from-git`) to preview them.
|
|
56
56
|
*
|
|
57
|
+
* A WORKING-TREE PREVIEW READS AS DRIFT UNDER `mx-agent doctor`, AND THAT IS THE
|
|
58
|
+
* INTENDED ANSWER (#247). `config-fidelity.ts` compares every layer against
|
|
59
|
+
* origin/<base>, because that is the tree `mx-agent start` deploys. A `.claude/`
|
|
60
|
+
* you wrote from the working tree — by a direct run here, or by the container-boot
|
|
61
|
+
* split at `--permission-from-git`, which takes agents/, skills/, commands/ and
|
|
62
|
+
* rules/ from the working tree — is a different tree, and `doctor` reports the
|
|
63
|
+
* difference. Nothing is wrong; the preview is not what a session would run. Run
|
|
64
|
+
* `mx-agent start`, or the `--from-git origin/<base>` invocation, to return the
|
|
65
|
+
* deployed tree to the state `doctor` certifies. There is no opt-in flag for
|
|
66
|
+
* checking a preview against the working tree; add one if anyone asks for it.
|
|
67
|
+
*
|
|
57
68
|
* GENERALIZATION (planned, not built here): the PO intends a future standard
|
|
58
69
|
* per-project overlay dir (likely `.mx-agent/` at the repo root) so the CLI
|
|
59
70
|
* behaves identically across memnexus / spearmint / api-evaluator. This is why
|
|
@@ -649,12 +660,32 @@ export function restorePermissionCacheToDest(destRoot) {
|
|
|
649
660
|
* backstop). Degraded-mode fallback for boot when
|
|
650
661
|
* the trusted origin snapshot is unavailable
|
|
651
662
|
* (fresh clone / offline). Never used per-session.
|
|
663
|
+
* @param {boolean} [opts.skipBehavioralLayer] the MIRROR of the flag above, for the
|
|
664
|
+
* other half of the tree: when true, DO NOT write
|
|
665
|
+
* rules/, agents/, skills/ or commands/ — leave
|
|
666
|
+
* whatever is already on disk. Used by the HOOK
|
|
667
|
+
* HEAL (claude.ts's regeneratePermissionLayer),
|
|
668
|
+
* which is asked to restore a missing hook and has
|
|
669
|
+
* no business rewriting the behavioural layers:
|
|
670
|
+
* `generateClaudeConfig` rewrites the WHOLE tree on
|
|
671
|
+
* every call, so a heal firing after
|
|
672
|
+
* `syncClaudeConfig` silently reverted the
|
|
673
|
+
* origin-sourced behavioural layers to working-tree
|
|
674
|
+
* content while its log line named only the hooks
|
|
675
|
+
* restored (#247, red-team Critical 1).
|
|
676
|
+
* The skipped layers survive the atomic swap
|
|
677
|
+
* through `carryOverUnmanaged`, which copies every
|
|
678
|
+
* existing dest entry the staging tree does not
|
|
679
|
+
* hold — the same mechanism that preserves
|
|
680
|
+
* settings.json and hooks/ under
|
|
681
|
+
* `skipPermissionLayer`.
|
|
652
682
|
*/
|
|
653
683
|
export function generateClaudeConfig(opts) {
|
|
654
684
|
const baseDir = resolve(opts.baseDir);
|
|
655
685
|
const overlayDir = resolve(opts.overlayDir);
|
|
656
686
|
const destRoot = resolve(opts.destRoot);
|
|
657
687
|
const skipPermissionLayer = Boolean(opts.skipPermissionLayer);
|
|
688
|
+
const skipBehavioralLayer = Boolean(opts.skipBehavioralLayer);
|
|
658
689
|
const permissionSrcDir = opts.permissionSrcDir ? resolve(opts.permissionSrcDir) : baseDir;
|
|
659
690
|
|
|
660
691
|
if (!skipPermissionLayer) {
|
|
@@ -726,69 +757,82 @@ export function generateClaudeConfig(opts) {
|
|
|
726
757
|
hookCount = hookNames.size;
|
|
727
758
|
}
|
|
728
759
|
|
|
760
|
+
// Steps 3 to 6 — the BEHAVIOURAL layers — are skipped as a block under
|
|
761
|
+
// skipBehavioralLayer. Each still declares its name set, so the returned
|
|
762
|
+
// counts are honest zeros rather than absent keys, and every caller that
|
|
763
|
+
// reads `result.counts.agents` keeps working.
|
|
764
|
+
//
|
|
729
765
|
// 3. rules/ — verbatim, 0644.
|
|
730
|
-
const rulesDest = guardManagedDir(join(staging, 'rules'));
|
|
731
|
-
mkdirSync(rulesDest, { recursive: true });
|
|
732
766
|
const ruleNames = new Set();
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
767
|
+
if (!skipBehavioralLayer) {
|
|
768
|
+
const rulesDest = guardManagedDir(join(staging, 'rules'));
|
|
769
|
+
mkdirSync(rulesDest, { recursive: true });
|
|
770
|
+
for (const ent of listDir(join(baseDir, 'rules'))) {
|
|
771
|
+
if (!ent.isFile()) continue;
|
|
772
|
+
writeManagedFile(join(rulesDest, ent.name), readFileSync(join(baseDir, 'rules', ent.name)), 0o644);
|
|
773
|
+
ruleNames.add(ent.name);
|
|
774
|
+
}
|
|
775
|
+
pruneExtras(rulesDest, ruleNames);
|
|
737
776
|
}
|
|
738
|
-
pruneExtras(rulesDest, ruleNames);
|
|
739
777
|
|
|
740
778
|
// 4. agents/ — union of base + overlay, 0644. Overlay overlays base on a
|
|
741
779
|
// name collision (last write wins) — by design disjoint today.
|
|
742
|
-
const agentsDest = guardManagedDir(join(staging, 'agents'));
|
|
743
|
-
mkdirSync(agentsDest, { recursive: true });
|
|
744
780
|
const agentNames = new Set();
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
781
|
+
if (!skipBehavioralLayer) {
|
|
782
|
+
const agentsDest = guardManagedDir(join(staging, 'agents'));
|
|
783
|
+
mkdirSync(agentsDest, { recursive: true });
|
|
784
|
+
for (const src of [join(baseDir, 'agents'), join(overlayDir, 'agents')]) {
|
|
785
|
+
for (const ent of listDir(src)) {
|
|
786
|
+
if (!ent.isFile()) continue;
|
|
787
|
+
writeManagedFile(join(agentsDest, ent.name), readFileSync(join(src, ent.name)), 0o644);
|
|
788
|
+
agentNames.add(ent.name);
|
|
789
|
+
}
|
|
750
790
|
}
|
|
791
|
+
pruneExtras(agentsDest, agentNames);
|
|
751
792
|
}
|
|
752
|
-
pruneExtras(agentsDest, agentNames);
|
|
753
793
|
|
|
754
794
|
// 5. skills/ — union of base + overlay skill DIRECTORIES, recursive, 0644.
|
|
755
|
-
const skillsDest = guardManagedDir(join(staging, 'skills'));
|
|
756
|
-
mkdirSync(skillsDest, { recursive: true });
|
|
757
795
|
const skillNames = new Set();
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
796
|
+
if (!skipBehavioralLayer) {
|
|
797
|
+
const skillsDest = guardManagedDir(join(staging, 'skills'));
|
|
798
|
+
mkdirSync(skillsDest, { recursive: true });
|
|
799
|
+
for (const src of [join(baseDir, 'skills'), join(overlayDir, 'skills')]) {
|
|
800
|
+
for (const ent of listDir(src)) {
|
|
801
|
+
if (!ent.isDirectory()) continue;
|
|
802
|
+
const d = join(skillsDest, ent.name);
|
|
803
|
+
guardManagedDir(d); // CRITICAL A: guard per-skill dir before mkdir
|
|
804
|
+
mkdirSync(d, { recursive: true });
|
|
805
|
+
copyFileTree(join(src, ent.name), d);
|
|
806
|
+
skillNames.add(ent.name);
|
|
807
|
+
}
|
|
766
808
|
}
|
|
809
|
+
pruneExtras(skillsDest, skillNames);
|
|
767
810
|
}
|
|
768
|
-
pruneExtras(skillsDest, skillNames);
|
|
769
811
|
|
|
770
812
|
// 6. commands/ — from overlay/commands only. All regular files now (the former
|
|
771
813
|
// mx-find/mx-rules/mx-save SYMLINKS were replaced by plain files), 0644.
|
|
772
|
-
const commandsSrc = join(overlayDir, 'commands');
|
|
773
|
-
const commandsDest = guardManagedDir(join(staging, 'commands'));
|
|
774
|
-
mkdirSync(commandsDest, { recursive: true });
|
|
775
814
|
const commandNames = new Set();
|
|
776
|
-
|
|
777
|
-
const
|
|
778
|
-
const
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
815
|
+
if (!skipBehavioralLayer) {
|
|
816
|
+
const commandsSrc = join(overlayDir, 'commands');
|
|
817
|
+
const commandsDest = guardManagedDir(join(staging, 'commands'));
|
|
818
|
+
mkdirSync(commandsDest, { recursive: true });
|
|
819
|
+
for (const ent of listDir(commandsSrc)) {
|
|
820
|
+
const s = join(commandsSrc, ent.name);
|
|
821
|
+
const d = join(commandsDest, ent.name);
|
|
822
|
+
if (ent.isSymbolicLink()) {
|
|
823
|
+
// Should be unreachable after the pre-scan; kept as defense-in-depth.
|
|
824
|
+
throw new Error(`generate-claude: FAIL-CLOSED — unexpected symlink in ${commandsSrc}: ${ent.name}`);
|
|
825
|
+
} else if (ent.isFile()) {
|
|
826
|
+
writeManagedFile(d, readFileSync(s), 0o644);
|
|
827
|
+
} else if (ent.isDirectory()) {
|
|
828
|
+
guardManagedDir(d); // CRITICAL A: guard per-command dir before mkdir
|
|
829
|
+
mkdirSync(d, { recursive: true });
|
|
830
|
+
copyFileTree(s, d);
|
|
831
|
+
}
|
|
832
|
+
commandNames.add(ent.name);
|
|
788
833
|
}
|
|
789
|
-
commandNames
|
|
834
|
+
pruneExtras(commandsDest, commandNames);
|
|
790
835
|
}
|
|
791
|
-
pruneExtras(commandsDest, commandNames);
|
|
792
836
|
|
|
793
837
|
// Defense-in-depth: the generated staging tree must contain zero symlinks
|
|
794
838
|
// (generation only emits plain files). Fail closed BEFORE the swap if not.
|
|
@@ -888,15 +932,26 @@ export function generateClaudeConfigFromGit(opts) {
|
|
|
888
932
|
* floor against naive Write/Edit TOOL use of protected paths only — they are not a
|
|
889
933
|
* Bash-level control and do not constrain shell commands.
|
|
890
934
|
*
|
|
935
|
+
* `opts.skipBehavioralLayer` narrows this to the permission layer alone, for the
|
|
936
|
+
* HOOK HEAL, which asks for a missing hook back and must not rewrite anything
|
|
937
|
+
* else (#247). The CONTAINER-BOOT behaviour — behavioural layers from the working
|
|
938
|
+
* tree — is unchanged when the flag is absent: that is a prior red-team CRITICAL 1
|
|
939
|
+
* fix and a real container boot still needs it. The flag rides through the degrade
|
|
940
|
+
* path too, so an offline heal restores the permission layer from the cache without
|
|
941
|
+
* regenerating the behavioural layers from the working tree either.
|
|
942
|
+
*
|
|
891
943
|
* @returns { result, permissionPinned } — permissionPinned=false ⇒ degraded.
|
|
892
944
|
*/
|
|
893
945
|
export function generateClaudeConfigForBoot(opts) {
|
|
894
946
|
const { permissionRef, repoRoot, destRoot, configSource = DEFAULT_CONFIG_SOURCE, warn } = opts;
|
|
947
|
+
const skipBehavioralLayer = Boolean(opts.skipBehavioralLayer);
|
|
895
948
|
const baseDir = join(repoRoot, configSource);
|
|
896
949
|
const overlayDir = join(baseDir, 'local');
|
|
897
950
|
try {
|
|
898
951
|
return withArchivedConfig(permissionRef, repoRoot, configSource, (permBase) => {
|
|
899
|
-
const result = generateClaudeConfig({
|
|
952
|
+
const result = generateClaudeConfig({
|
|
953
|
+
baseDir, overlayDir, destRoot, permissionSrcDir: permBase, skipBehavioralLayer,
|
|
954
|
+
});
|
|
900
955
|
// Permission layer was origin-pinned — refresh the degrade-path cache.
|
|
901
956
|
refreshPermissionCache(permBase);
|
|
902
957
|
return { result, permissionPinned: true };
|
|
@@ -906,7 +961,9 @@ export function generateClaudeConfigForBoot(opts) {
|
|
|
906
961
|
// only the non-permission layers, then restore the permission layer from the
|
|
907
962
|
// last-known-good cache (integrity-checked, not origin-authenticated). If no
|
|
908
963
|
// cache exists, leave the committed backstop in place but warn UNVERIFIED.
|
|
909
|
-
const result = generateClaudeConfig({
|
|
964
|
+
const result = generateClaudeConfig({
|
|
965
|
+
baseDir, overlayDir, destRoot, skipPermissionLayer: true, skipBehavioralLayer,
|
|
966
|
+
});
|
|
910
967
|
const detail = err instanceof Error ? err.message : String(err);
|
|
911
968
|
const restoredHash = restorePermissionCacheToDest(destRoot);
|
|
912
969
|
if (typeof warn === 'function') {
|
|
@@ -935,6 +992,7 @@ function parseArgs(argv) {
|
|
|
935
992
|
else if (a === '--from-git') out.fromGit = argv[++i];
|
|
936
993
|
else if (a === '--permission-from-git') out.permissionFromGit = argv[++i];
|
|
937
994
|
else if (a === '--config-source') out.configSource = argv[++i];
|
|
995
|
+
else if (a === '--skip-behavioral-layer') out.skipBehavioralLayer = true;
|
|
938
996
|
else if (a === '--quiet') out.quiet = true;
|
|
939
997
|
else if (a === '--help' || a === '-h') out.help = true;
|
|
940
998
|
}
|
|
@@ -946,10 +1004,21 @@ function main(argv) {
|
|
|
946
1004
|
if (args.help) {
|
|
947
1005
|
process.stdout.write(
|
|
948
1006
|
'Usage: generate-claude.mjs --repo-root <path> [--dest <path>] ' +
|
|
949
|
-
'[--from-git <ref>] [--permission-from-git <ref>] [--
|
|
1007
|
+
'[--from-git <ref>] [--permission-from-git <ref>] [--skip-behavioral-layer] ' +
|
|
1008
|
+
'[--config-source <rel>] [--quiet]\n',
|
|
950
1009
|
);
|
|
951
1010
|
return 0;
|
|
952
1011
|
}
|
|
1012
|
+
if (args.skipBehavioralLayer && !args.permissionFromGit) {
|
|
1013
|
+
// A flag that silently does nothing is the fail-quiet this repo's standard
|
|
1014
|
+
// refuses. It narrows the container-boot split and has no meaning on the
|
|
1015
|
+
// whole-tree paths, where skipping the behavioural layers would leave
|
|
1016
|
+
// nothing to write.
|
|
1017
|
+
process.stderr.write(
|
|
1018
|
+
'generate-claude: --skip-behavioral-layer applies only to --permission-from-git\n',
|
|
1019
|
+
);
|
|
1020
|
+
return 1;
|
|
1021
|
+
}
|
|
953
1022
|
const repoRoot = resolve(args.repoRoot || process.cwd());
|
|
954
1023
|
const configSource = args.configSource || DEFAULT_CONFIG_SOURCE;
|
|
955
1024
|
const destRoot = resolve(args.dest || join(repoRoot, '.claude'));
|
|
@@ -962,9 +1031,13 @@ function main(argv) {
|
|
|
962
1031
|
} else if (args.permissionFromGit) {
|
|
963
1032
|
// Container-boot split: permission layer from origin/<base>, rest from the
|
|
964
1033
|
// working tree. Degrades (warns) to committed permission layer when offline.
|
|
1034
|
+
// With --skip-behavioral-layer the "rest" is not written at all — the hook
|
|
1035
|
+
// heal's invocation, which must restore hooks without touching anything
|
|
1036
|
+
// else (#247).
|
|
965
1037
|
const warn = args.quiet ? undefined : (m) => process.stderr.write(`generate-claude: ${m}\n`);
|
|
966
1038
|
result = generateClaudeConfigForBoot({
|
|
967
1039
|
permissionRef: args.permissionFromGit, repoRoot, destRoot, configSource, warn,
|
|
1040
|
+
skipBehavioralLayer: args.skipBehavioralLayer,
|
|
968
1041
|
}).result;
|
|
969
1042
|
} else {
|
|
970
1043
|
// Working-tree mode: base is <repoRoot>/<configSource>, overlay defaults to
|