session-orchestrator 3.21.0 → 3.23.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor/commands/autopilot-multi.md +14 -0
- package/.cursor/commands/autopilot.md +14 -0
- package/.cursor/commands/bootstrap.md +14 -0
- package/.cursor/commands/brainstorm.md +14 -0
- package/.cursor/commands/close.md +13 -0
- package/.cursor/commands/contract-version-bump.md +14 -0
- package/.cursor/commands/debug.md +14 -0
- package/.cursor/commands/discovery.md +14 -0
- package/.cursor/commands/dispatcher.md +14 -0
- package/.cursor/commands/eli5.md +14 -0
- package/.cursor/commands/eval.md +14 -0
- package/.cursor/commands/evolve.md +14 -0
- package/.cursor/commands/go.md +14 -0
- package/.cursor/commands/grill.md +14 -0
- package/.cursor/commands/harness-audit.md +13 -0
- package/.cursor/commands/journey-audit.md +14 -0
- package/.cursor/commands/memory-cleanup.md +14 -0
- package/.cursor/commands/persona-panel.md +14 -0
- package/.cursor/commands/plan.md +14 -0
- package/.cursor/commands/portfolio.md +14 -0
- package/.cursor/commands/reconcile.md +14 -0
- package/.cursor/commands/release.md +14 -0
- package/.cursor/commands/repo-audit.md +13 -0
- package/.cursor/commands/session.md +14 -0
- package/.cursor/commands/spinout.md +14 -0
- package/.cursor/commands/sunset-review.md +14 -0
- package/.cursor/commands/templates-ack.md +14 -0
- package/.cursor/commands/test.md +14 -0
- package/.cursor/hooks.json +60 -0
- package/.cursor/rules/000-session-orchestrator.mdc +11 -2
- package/.cursor/rules/010-session-workflow.mdc +9 -1
- package/.cursor/rules/020-quality-gates.mdc +1 -1
- package/.cursor/rules/030-wave-execution.mdc +1 -1
- package/.cursor/rules/040-discovery.mdc +6 -6
- package/.cursor/rules/050-plan.mdc +10 -10
- package/.cursor/rules/070-gitlab-ops.mdc +73 -57
- package/.cursor/rules/080-ecosystem-health.mdc +7 -7
- package/.cursor/skills/architecture/SKILL.md +13 -0
- package/.cursor/skills/autopilot/SKILL.md +12 -0
- package/.cursor/skills/bootstrap/SKILL.md +12 -0
- package/.cursor/skills/brainstorm/SKILL.md +13 -0
- package/.cursor/skills/claude-md-drift-check/SKILL.md +13 -0
- package/.cursor/skills/contract-version-bump/SKILL.md +12 -0
- package/.cursor/skills/convergence-monitoring/SKILL.md +12 -0
- package/.cursor/skills/daily/SKILL.md +12 -0
- package/.cursor/skills/debug/SKILL.md +13 -0
- package/.cursor/skills/discovery/SKILL.md +13 -0
- package/.cursor/skills/dispatcher/SKILL.md +13 -0
- package/.cursor/skills/docs-orchestrator/SKILL.md +13 -0
- package/.cursor/skills/domain-model/SKILL.md +13 -0
- package/.cursor/skills/ecosystem-health/SKILL.md +13 -0
- package/.cursor/skills/eli5/SKILL.md +13 -0
- package/.cursor/skills/eval/SKILL.md +12 -0
- package/.cursor/skills/evolve/SKILL.md +13 -0
- package/.cursor/skills/frontmatter-guard/SKILL.md +13 -0
- package/.cursor/skills/gitlab-ops/SKILL.md +13 -0
- package/.cursor/skills/gitlab-portfolio/SKILL.md +13 -0
- package/.cursor/skills/grill/SKILL.md +13 -0
- package/.cursor/skills/hook-development/SKILL.md +13 -0
- package/.cursor/skills/journey-audit/SKILL.md +13 -0
- package/.cursor/skills/mcp-builder/SKILL.md +13 -0
- package/.cursor/skills/memory-cleanup/SKILL.md +12 -0
- package/.cursor/skills/mode-selector/SKILL.md +13 -0
- package/.cursor/skills/npm-publish/SKILL.md +12 -0
- package/.cursor/skills/peekaboo-driver/SKILL.md +13 -0
- package/.cursor/skills/persona-panel/SKILL.md +12 -0
- package/.cursor/skills/plan/SKILL.md +13 -0
- package/.cursor/skills/playwright-driver/SKILL.md +13 -0
- package/.cursor/skills/quality-gates/SKILL.md +13 -0
- package/.cursor/skills/reconcile/SKILL.md +12 -0
- package/.cursor/skills/repo-audit/SKILL.md +13 -0
- package/.cursor/skills/session-end/SKILL.md +13 -0
- package/.cursor/skills/session-plan/SKILL.md +13 -0
- package/.cursor/skills/session-start/SKILL.md +13 -0
- package/.cursor/skills/skill-creator/SKILL.md +13 -0
- package/.cursor/skills/spinout/SKILL.md +12 -0
- package/.cursor/skills/sunset-review/SKILL.md +13 -0
- package/.cursor/skills/test-runner/SKILL.md +13 -0
- package/.cursor/skills/tmux-layout/SKILL.md +13 -0
- package/.cursor/skills/ubiquitous-language/SKILL.md +13 -0
- package/.cursor/skills/using-orchestrator/SKILL.md +13 -0
- package/.cursor/skills/vault-mirror/SKILL.md +13 -0
- package/.cursor/skills/vault-sync/SKILL.md +13 -0
- package/.cursor/skills/wave-executor/SKILL.md +13 -0
- package/.cursor/skills/write-executable-plan/SKILL.md +13 -0
- package/.mcp.json +4 -1
- package/CHANGELOG.md +269 -0
- package/README.md +18 -15
- package/agents/AGENTS.md +23 -4
- package/agents/code-implementer.md +2 -1
- package/agents/db-specialist.md +2 -1
- package/agents/docs-writer.md +3 -1
- package/agents/eval-judge.md +1 -1
- package/agents/memory-proposal-collector.md +6 -4
- package/agents/session-reviewer.md +7 -1
- package/agents/test-writer.md +2 -1
- package/agents/ui-developer.md +2 -1
- package/commands/bootstrap.md +2 -2
- package/commands/close.md +3 -1
- package/commands/eli5.md +33 -0
- package/commands/go.md +1 -1
- package/commands/journey-audit.md +43 -0
- package/commands/release.md +5 -3
- package/commands/test.md +2 -2
- package/docs/USER-GUIDE.md +2 -2
- package/docs/ci-setup.md +14 -0
- package/docs/codex-setup.md +64 -0
- package/docs/components.md +7 -6
- package/docs/cursor-setup.md +26 -47
- package/docs/events-schema.md +76 -4
- package/docs/github-mirror-protection.md +197 -0
- package/docs/pi-setup.md +2 -0
- package/docs/rule-authoring.md +3 -1
- package/docs/scope-collision-guard.md +52 -5
- package/docs/session-config-reference.md +57 -12
- package/docs/session-config-template.md +4 -3
- package/docs/telemetry.md +22 -0
- package/hooks/_lib/lock-bootstrap.mjs +26 -16
- package/hooks/_lib/vcs-create-matcher.mjs +397 -38
- package/hooks/enforce-scope.mjs +64 -0
- package/hooks/hooks-codex.json +1 -1
- package/hooks/hooks-cursor.json +201 -20
- package/hooks/hooks-pi.json +1 -1
- package/hooks/hooks.json +12 -2
- package/hooks/on-session-end.mjs +237 -104
- package/hooks/on-session-start.mjs +404 -110
- package/hooks/on-stop.mjs +48 -9
- package/hooks/post-subagent-discovery-validator.mjs +34 -3
- package/hooks/post-tool-batch-wave-signal.mjs +11 -2
- package/hooks/pre-auq-clarity.mjs +787 -0
- package/hooks/pre-bash-issue-budget.mjs +133 -21
- package/hooks/pre-bash-sessions-ledger-guard.mjs +159 -0
- package/hooks/pre-bash-staging-fence.mjs +4 -0
- package/hooks/pre-task-scope-disjoint.mjs +368 -35
- package/hooks/skill-invocation-telemetry.mjs +21 -10
- package/monitors/monitors.json +6 -0
- package/package.json +3 -1
- package/pi/prompts/eli5.md +12 -0
- package/pi/prompts/journey-audit.md +12 -0
- package/rules/_index.md +9 -1
- package/rules/always-on/ask-via-tool.md +62 -0
- package/rules/always-on/bash-harness-pitfalls.md +168 -0
- package/rules/always-on/build-value.md +47 -0
- package/rules/always-on/cross-session-messaging.md +59 -0
- package/rules/always-on/loop-and-monitor.md +221 -0
- package/rules/always-on/parallel-sessions.md +142 -12
- package/rules/always-on/receiving-review.md +108 -0
- package/rules/always-on/test-value.md +40 -0
- package/rules/always-on/verification-before-completion.md +77 -0
- package/scripts/archive-closed-prds.mjs +258 -18
- package/scripts/auq-audit.mjs +825 -0
- package/scripts/autopilot.mjs +12 -8
- package/scripts/backfill-evidence-digest.mjs +376 -0
- package/scripts/cursor-install.mjs +89 -48
- package/scripts/export-hw-learnings.mjs +143 -2
- package/scripts/express-path.mjs +299 -0
- package/scripts/generate-cursor-adapter.mjs +253 -0
- package/scripts/github-protection-audit.mjs +358 -0
- package/scripts/lib/auq/clarity.mjs +1314 -0
- package/scripts/lib/auq/parse.mjs +1006 -0
- package/scripts/lib/auq/schema.mjs +1457 -0
- package/scripts/lib/autopilot/worktree-pipeline.mjs +240 -16
- package/scripts/lib/build-live-signals.mjs +24 -5
- package/scripts/lib/ci-status-banner.mjs +221 -68
- package/scripts/lib/command-blocker.mjs +70 -0
- package/scripts/lib/config/dispatcher-autonomy-capture.mjs +32 -9
- package/scripts/lib/config/reconcile.mjs +79 -4
- package/scripts/lib/config/section-extractor.mjs +235 -36
- package/scripts/lib/config/vault-integration.mjs +12 -1
- package/scripts/lib/config-schema.mjs +9 -1
- package/scripts/lib/config.mjs +57 -6
- package/scripts/lib/convergence-monitor.mjs +13 -2
- package/scripts/lib/cursor-hook-bridge.mjs +443 -0
- package/scripts/lib/dispatcher/cli.mjs +2 -2
- package/scripts/lib/dispatcher/rank.mjs +4 -7
- package/scripts/lib/express-path.mjs +327 -0
- package/scripts/lib/file-lock.mjs +22 -4
- package/scripts/lib/gates/gate-full.mjs +84 -11
- package/scripts/lib/gates/gate-helpers.mjs +93 -21
- package/scripts/lib/git-config-drift.mjs +134 -5
- package/scripts/lib/host-identity.mjs +247 -2
- package/scripts/lib/instruction-budget-guard.mjs +31 -1
- package/scripts/lib/io.mjs +239 -0
- package/scripts/lib/issue-budget.mjs +284 -31
- package/scripts/lib/learnings/io.mjs +55 -10
- package/scripts/lib/learnings/schema.mjs +95 -28
- package/scripts/lib/lock-reaper.mjs +7 -1
- package/scripts/lib/locks/staging-fence-lock.mjs +5 -1
- package/scripts/lib/locks/state-md-lock.mjs +8 -1
- package/scripts/lib/memory-banner.mjs +5 -2
- package/scripts/lib/memory-paths.mjs +15 -6
- package/scripts/lib/mode-selector/scoring.mjs +53 -6
- package/scripts/lib/owner-interview.mjs +78 -32
- package/scripts/lib/peer-discovery.mjs +73 -22
- package/scripts/lib/platform.mjs +72 -9
- package/scripts/lib/plugin-root.mjs +143 -19
- package/scripts/lib/project-hygiene.mjs +104 -4
- package/scripts/lib/quality-gate.mjs +271 -13
- package/scripts/lib/reconcile/emitter.mjs +87 -19
- package/scripts/lib/reconcile/engine.mjs +281 -13
- package/scripts/lib/reconcile/idempotency.mjs +102 -1
- package/scripts/lib/reconcile/renderer.mjs +165 -7
- package/scripts/lib/reconcile/sanitize.mjs +40 -17
- package/scripts/lib/reconcile/writer.mjs +415 -84
- package/scripts/lib/resource-probe/evaluate.mjs +330 -149
- package/scripts/lib/resource-probe/probe-platform.mjs +35 -0
- package/scripts/lib/resource-probe.mjs +18 -2
- package/scripts/lib/rule-loader.mjs +37 -2
- package/scripts/lib/rules-sync.mjs +51 -8
- package/scripts/lib/scope-gate.mjs +90 -0
- package/scripts/lib/session-close-backfill.mjs +369 -28
- package/scripts/lib/session-discovery.mjs +13 -3
- package/scripts/lib/session-end/phase-skip.mjs +37 -4
- package/scripts/lib/session-end/worktree-cleanup.mjs +154 -7
- package/scripts/lib/session-id.mjs +30 -14
- package/scripts/lib/session-identity/own-session.mjs +159 -0
- package/scripts/lib/session-lock.mjs +85 -30
- package/scripts/lib/session-schema/normalizer.mjs +70 -3
- package/scripts/lib/session-schema/validator.mjs +40 -0
- package/scripts/lib/session-start-probes.mjs +608 -0
- package/scripts/lib/session-transition.mjs +277 -0
- package/scripts/lib/sessions-staleness-banner.mjs +124 -57
- package/scripts/lib/spiral-carryover.mjs +111 -9
- package/scripts/lib/state-md/frontmatter-mutators.mjs +41 -8
- package/scripts/lib/state-md/mission-status.mjs +467 -72
- package/scripts/lib/state-md/yaml-parser.mjs +145 -16
- package/scripts/lib/state-md.mjs +12 -2
- package/scripts/lib/telemetry/sync.mjs +46 -8
- package/scripts/lib/validate/check-agents.mjs +66 -0
- package/scripts/lib/validate/check-auq-clarity.mjs +274 -0
- package/scripts/lib/validate/check-cursor-adapter.mjs +102 -0
- package/scripts/lib/validate/check-dead-bridge.mjs +24 -2
- package/scripts/lib/validate/check-doc-cli-commands.mjs +16 -32
- package/scripts/lib/validate/check-hooks-symmetry.mjs +59 -63
- package/scripts/lib/validate/check-playwright-mcp-canary.mjs +13 -22
- package/scripts/lib/validate/check-plugin-monitors.mjs +10 -4
- package/scripts/lib/validate/check-rules.mjs +153 -9
- package/scripts/lib/validate/check-test-value-bans.mjs +165 -17
- package/scripts/lib/validate/check-unwired-features.mjs +340 -32
- package/scripts/lib/validate/repo-files.mjs +275 -0
- package/scripts/lib/validate-vendored-rules.mjs +229 -7
- package/scripts/lib/vault-backfill/glab.mjs +91 -58
- package/scripts/lib/vault-backfill/manifest.mjs +28 -8
- package/scripts/lib/vault-mirror/process.mjs +99 -43
- package/scripts/lib/vault-mirror/telemetry.mjs +210 -0
- package/scripts/lib/vault-staleness-banner.mjs +76 -6
- package/scripts/lib/vault-status/board-writer.mjs +211 -10
- package/scripts/lib/vault-status/narrative-mirror.mjs +188 -8
- package/scripts/lib/vcs-repo-spec.mjs +182 -13
- package/scripts/lib/wave-executor/foreign-dispatch.mjs +832 -0
- package/scripts/lib/wave-resource-gate.mjs +67 -73
- package/scripts/lib/wave-transcript-tail.mjs +869 -0
- package/scripts/materialize-wave-scope.mjs +478 -0
- package/scripts/mcp-server.sh +11 -2
- package/scripts/parse-config.mjs +65 -0
- package/scripts/release.mjs +443 -122
- package/scripts/run-quality-gate.mjs +14 -0
- package/scripts/token-audit.sh +9 -2
- package/scripts/validate-plugin.mjs +6 -0
- package/scripts/validate-wave-scope.mjs +73 -1
- package/scripts/vault-backfill.mjs +32 -5
- package/scripts/vault-mirror.mjs +203 -34
- package/skills/_shared/monitor-patterns.md +31 -5
- package/skills/_shared/parallel-aware-auq.md +31 -25
- package/skills/_shared/parallel-aware-preamble.md +35 -4
- package/skills/_shared/platform-tools.md +11 -5
- package/skills/_shared/state-ownership.md +61 -8
- package/skills/autopilot/SKILL.md +5 -1
- package/skills/bootstrap/SKILL.md +5 -4
- package/skills/bootstrap/_shared-template.md +18 -10
- package/skills/bootstrap/deep-template.md +10 -6
- package/skills/bootstrap/fast-template.md +15 -8
- package/skills/bootstrap/standard-template.md +10 -6
- package/skills/brainstorm/SKILL.md +18 -18
- package/skills/brainstorm/soul.md +12 -0
- package/skills/claude-md-drift-check/checker.mjs +39 -11
- package/skills/discovery/SKILL.md +28 -24
- package/skills/dispatcher/SKILL.md +1 -1
- package/skills/eli5/SKILL.md +43 -0
- package/skills/evolve/SKILL.md +8 -9
- package/skills/gitlab-ops/SKILL.md +30 -26
- package/skills/grill/SKILL.md +6 -6
- package/skills/grill/soul.md +16 -0
- package/skills/journey-audit/SKILL.md +269 -0
- package/skills/memory-cleanup/SKILL.md +2 -2
- package/skills/npm-publish/SKILL.md +4 -4
- package/skills/peekaboo-driver/SKILL.md +18 -6
- package/skills/persona-panel/SKILL.md +1 -1
- package/skills/plan/SKILL.md +18 -16
- package/skills/plan/mode-feature.md +1 -1
- package/skills/plan/mode-new.md +35 -23
- package/skills/plan/soul.md +12 -0
- package/skills/reconcile/SKILL.md +44 -4
- package/skills/session-end/SKILL.md +70 -24
- package/skills/session-end/metrics-collection.md +7 -4
- package/skills/session-end/phase-3-6-tail.md +48 -5
- package/skills/session-end/phase-3-7a-recommendations.md +16 -2
- package/skills/session-plan/SKILL.md +6 -1
- package/skills/session-plan/wave-template.md +1 -0
- package/skills/session-start/SKILL.md +96 -48
- package/skills/session-start/phase-2-5-docs-planning.md +8 -8
- package/skills/session-start/phase-4-5-resource-health.md +82 -19
- package/skills/session-start/phase-7-5-mode-selector.md +15 -3
- package/skills/session-start/phase-8-5-express-path.md +77 -12
- package/skills/session-start/soul.md +110 -0
- package/skills/test-runner/SKILL.md +2 -2
- package/skills/using-orchestrator/SKILL.md +1 -1
- package/skills/vault-sync/validator.mjs +31 -0
- package/skills/wave-executor/SKILL.md +4 -2
- package/skills/wave-executor/circuit-breaker.md +34 -9
- package/skills/wave-executor/wave-loop.md +129 -24
- package/skills/write-executable-plan/SKILL.md +6 -6
- package/templates/_shared/journey-manifest.md +110 -0
- package/scripts/tests/fixtures/fetch-baseline/sample-rule.md +0 -8
- package/skills/vault-sync/tests/fixtures/archive-test-vault/90-archive/bad-archived.md +0 -8
- package/skills/vault-sync/tests/fixtures/archive-test-vault/_meta/.gitkeep +0 -0
- package/skills/vault-sync/tests/fixtures/archive-test-vault/live-note.md +0 -8
- package/skills/vault-sync/tests/fixtures/broken-frontmatter-vault/_meta/.gitkeep +0 -0
- package/skills/vault-sync/tests/fixtures/broken-frontmatter-vault/bad-type.md +0 -8
- package/skills/vault-sync/tests/fixtures/broken-frontmatter-vault/good-note.md +0 -8
- package/skills/vault-sync/tests/fixtures/clean-vault/.obsidian/config.md +0 -8
- package/skills/vault-sync/tests/fixtures/clean-vault/01-projects/foo/projects-baseline.md +0 -10
- package/skills/vault-sync/tests/fixtures/clean-vault/03-daily/daily-2026-04-13.md +0 -8
- package/skills/vault-sync/tests/fixtures/clean-vault/README.md +0 -3
- package/skills/vault-sync/tests/fixtures/clean-vault/hello-world.md +0 -11
- package/skills/vault-sync/tests/fixtures/dangling-link-vault/_meta/.gitkeep +0 -0
- package/skills/vault-sync/tests/fixtures/dangling-link-vault/has-dangling.md +0 -9
- package/skills/vault-sync/tests/fixtures/dangling-link-vault/real-target.md +0 -8
- package/skills/vault-sync/tests/fixtures/empty-vault/_meta/.gitkeep +0 -0
- package/skills/vault-sync/tests/fixtures/missing-field-vault/_meta/.gitkeep +0 -0
- package/skills/vault-sync/tests/fixtures/missing-field-vault/missing-id.md +0 -7
- package/skills/vault-sync/tests/fixtures/nested-tag-vault/03-daily/daily-2026-04-13.md +0 -9
- package/skills/vault-sync/tests/fixtures/nested-tag-vault/_meta/.gitkeep +0 -0
- package/skills/vault-sync/tests/fixtures/nested-tag-vault/nested-tags-note.md +0 -11
- package/skills/vault-sync/tests/fixtures/no-frontmatter-vault/README.md +0 -3
- package/skills/vault-sync/tests/fixtures/no-frontmatter-vault/_MOC.md +0 -3
- package/skills/vault-sync/tests/fixtures/no-frontmatter-vault/_meta/.gitkeep +0 -0
- package/skills/vault-sync/tests/fixtures/with-moc-vault/_MOC.md +0 -11
- package/skills/vault-sync/tests/fixtures/with-moc-vault/_meta/.gitkeep +0 -0
- package/skills/vault-sync/tests/fixtures/with-moc-vault/hello-world.md +0 -11
- package/skills/vault-sync/tests/schema-drift.test.mjs +0 -133
- package/templates/_shared/rules/parallel-sessions.md +0 -77
|
File without changes
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: nested-tags-note
|
|
3
|
-
type: note
|
|
4
|
-
created: 2026-04-13
|
|
5
|
-
updated: 2026-04-13
|
|
6
|
-
title: Nested Tags Note
|
|
7
|
-
tags: [meta/schema, status/in-progress, area/infrastructure, session/2026-04-13]
|
|
8
|
-
status: active
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
A note that uses Obsidian nested-tag conventions (slash-separated hierarchy).
|
|
File without changes
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Map of Content
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
# Map of Content
|
|
6
|
-
|
|
7
|
-
This is an index file that intentionally lacks the full note frontmatter
|
|
8
|
-
(no `id`, `type`, `created`, or `updated`). Validator should report errors
|
|
9
|
-
unless this file is excluded via `--exclude "**/_MOC.md"`.
|
|
10
|
-
|
|
11
|
-
- [[hello-world]]
|
|
File without changes
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* schema-drift.test.mjs — Integration tests for sync-vault-schema.mjs
|
|
3
|
-
*
|
|
4
|
-
* Verifies that the vendored schema block in validator.mjs stays in lockstep
|
|
5
|
-
* with the canonical TypeScript source. Tests run the actual script against
|
|
6
|
-
* actual files — no mocks.
|
|
7
|
-
*
|
|
8
|
-
* Run from session-orchestrator root:
|
|
9
|
-
* pnpm exec vitest run skills/vault-sync/tests/schema-drift.test.mjs
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { describe, it, expect } from 'vitest';
|
|
13
|
-
import { execFileSync } from 'node:child_process';
|
|
14
|
-
import { readFileSync, writeFileSync, mkdirSync, rmSync, existsSync } from 'node:fs';
|
|
15
|
-
import { join, dirname } from 'node:path';
|
|
16
|
-
import { fileURLToPath } from 'node:url';
|
|
17
|
-
import { tmpdir } from 'node:os';
|
|
18
|
-
|
|
19
|
-
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
20
|
-
|
|
21
|
-
// Paths relative to this test file
|
|
22
|
-
const SYNC_SCRIPT = join(__dirname, '../../../scripts/sync-vault-schema.mjs');
|
|
23
|
-
const VALIDATOR_MJS = join(__dirname, '../validator.mjs');
|
|
24
|
-
const CANONICAL = join(
|
|
25
|
-
__dirname,
|
|
26
|
-
'../../../../projects-baseline/packages/zod-schemas/src/vault-frontmatter.ts',
|
|
27
|
-
);
|
|
28
|
-
// Tests below shell out to sync-vault-schema.mjs, which by default reads
|
|
29
|
-
// the canonical schema from a sibling projects-baseline checkout. In CI
|
|
30
|
-
// (and on any contributor machine without that checkout) the canonical
|
|
31
|
-
// file is absent, so we skip these integration tests. The schema-drift
|
|
32
|
-
// CI stage runs the script directly against a freshly cloned canonical.
|
|
33
|
-
const HAS_CANONICAL = existsSync(CANONICAL);
|
|
34
|
-
|
|
35
|
-
const SENTINEL_BEGIN = 'BEGIN GENERATED SCHEMA';
|
|
36
|
-
const SENTINEL_END = 'END GENERATED SCHEMA';
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Run sync-vault-schema.mjs with given args.
|
|
40
|
-
* Returns { status, stdout, stderr }.
|
|
41
|
-
* Never throws — captures non-zero exits via try/catch.
|
|
42
|
-
*/
|
|
43
|
-
function runScript(args = []) {
|
|
44
|
-
try {
|
|
45
|
-
const stdout = execFileSync(process.execPath, [SYNC_SCRIPT, ...args], {
|
|
46
|
-
encoding: 'utf-8',
|
|
47
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
48
|
-
});
|
|
49
|
-
return { status: 0, stdout, stderr: '' };
|
|
50
|
-
} catch (err) {
|
|
51
|
-
return {
|
|
52
|
-
status: err.status ?? 1,
|
|
53
|
-
stdout: err.stdout ?? '',
|
|
54
|
-
stderr: err.stderr ?? '',
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
describe.skipIf(!HAS_CANONICAL)('sync-vault-schema.mjs', () => {
|
|
60
|
-
it('idempotency — running --write twice produces no diff between runs', () => {
|
|
61
|
-
// Read validator.mjs before any writes
|
|
62
|
-
const before = readFileSync(VALIDATOR_MJS, 'utf-8');
|
|
63
|
-
|
|
64
|
-
// First --write
|
|
65
|
-
const first = runScript(['--write']);
|
|
66
|
-
expect(first.status, `first --write failed: ${first.stderr}`).toBe(0);
|
|
67
|
-
|
|
68
|
-
// Read after first write
|
|
69
|
-
const afterFirst = readFileSync(VALIDATOR_MJS, 'utf-8');
|
|
70
|
-
expect(afterFirst).toBe(before);
|
|
71
|
-
|
|
72
|
-
// Second --write
|
|
73
|
-
const second = runScript(['--write']);
|
|
74
|
-
expect(second.status, `second --write failed: ${second.stderr}`).toBe(0);
|
|
75
|
-
|
|
76
|
-
// Read after second write
|
|
77
|
-
const afterSecond = readFileSync(VALIDATOR_MJS, 'utf-8');
|
|
78
|
-
expect(afterSecond).toBe(before);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('check-mode-clean — --check exits 0 when canonical and vendored are in sync', () => {
|
|
82
|
-
const result = runScript(['--check']);
|
|
83
|
-
expect(result.status, `--check failed unexpectedly: ${result.stderr}`).toBe(0);
|
|
84
|
-
expect(result.stdout).toContain('no drift');
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('check-mode-detects-drift — --check exits 1 with diff when canonical differs', () => {
|
|
88
|
-
// Build a temporary fake canonical with a different max for the id field
|
|
89
|
-
const rand = Math.random().toString(36).slice(2);
|
|
90
|
-
const tmpDir = join(tmpdir(), `sync-vault-schema-test-${rand}`);
|
|
91
|
-
mkdirSync(tmpDir, { recursive: true });
|
|
92
|
-
const fakeCanonical = join(tmpDir, 'vault-frontmatter.ts');
|
|
93
|
-
|
|
94
|
-
// Read the real canonical and alter it: change .max(128) to .max(256) for id
|
|
95
|
-
const realCanonical = readFileSync(CANONICAL, 'utf-8');
|
|
96
|
-
const altered = realCanonical.replace('.max(128)', '.max(256)');
|
|
97
|
-
writeFileSync(fakeCanonical, altered, 'utf-8');
|
|
98
|
-
|
|
99
|
-
try {
|
|
100
|
-
const result = runScript(['--check', '--canonical', fakeCanonical]);
|
|
101
|
-
expect(result.status, 'expected exit 1 for drift').toBe(1);
|
|
102
|
-
// Diff should mention the changed value
|
|
103
|
-
expect(result.stderr).toMatch(/256|drift/);
|
|
104
|
-
} finally {
|
|
105
|
-
rmSync(tmpDir, { recursive: true, force: true });
|
|
106
|
-
}
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
it('failure-mode-missing-canonical — exits 2 with clear message when canonical not found', () => {
|
|
110
|
-
const rand = Math.random().toString(36).slice(2);
|
|
111
|
-
const fakePath = join(tmpdir(), `does-not-exist-${rand}.ts`);
|
|
112
|
-
|
|
113
|
-
const result = runScript(['--check', '--canonical', fakePath]);
|
|
114
|
-
expect(result.status, 'expected exit 2 for missing file').toBe(2);
|
|
115
|
-
expect(result.stderr).toContain(fakePath);
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it('sentinel-presence — validator.mjs contains both sentinel markers exactly once in correct order', () => {
|
|
119
|
-
const content = readFileSync(VALIDATOR_MJS, 'utf-8');
|
|
120
|
-
|
|
121
|
-
// Count occurrences
|
|
122
|
-
const beginCount = (content.match(/BEGIN GENERATED SCHEMA/g) ?? []).length;
|
|
123
|
-
const endCount = (content.match(/END GENERATED SCHEMA/g) ?? []).length;
|
|
124
|
-
|
|
125
|
-
expect(beginCount, 'BEGIN GENERATED SCHEMA must appear exactly once').toBe(1);
|
|
126
|
-
expect(endCount, 'END GENERATED SCHEMA must appear exactly once').toBe(1);
|
|
127
|
-
|
|
128
|
-
// BEGIN must appear before END
|
|
129
|
-
const beginPos = content.indexOf(SENTINEL_BEGIN);
|
|
130
|
-
const endPos = content.indexOf(SENTINEL_END);
|
|
131
|
-
expect(beginPos, 'BEGIN sentinel must appear before END sentinel').toBeLessThan(endPos);
|
|
132
|
-
});
|
|
133
|
-
});
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# Parallel Session Awareness (Always-on)
|
|
2
|
-
|
|
3
|
-
Multiple Claude Code sessions may be active in the same working directory simultaneously. Another agent may be editing files, creating commits, or running builds right now. Treat the repo as a shared workspace, not a private sandbox.
|
|
4
|
-
|
|
5
|
-
## PSA Scope Axes — Operator-Session vs In-Run
|
|
6
|
-
|
|
7
|
-
PSA rules span two distinct axes. Naming them keeps the durable moat clear when
|
|
8
|
-
native multi-agent primitives (the experimental `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS`)
|
|
9
|
-
overlap parts of this surface.
|
|
10
|
-
|
|
11
|
-
- **Operator-session axis (the durable moat):** independent parallel operator /
|
|
12
|
-
Claude sessions in the **same working copy**. PSA-001..004, plus the per-repo
|
|
13
|
-
session lock (`scripts/lib/session-lock.mjs` `acquire()` / `session.lock`,
|
|
14
|
-
heartbeat-liveness schema v2), guard this domain. **Agent Teams structurally
|
|
15
|
-
cannot enter it** — Teams is per-process / in-run only ("one team per
|
|
16
|
-
session"), NOT per-repo. Its graduation to native affects **only the in-run
|
|
17
|
-
multi-agent coordination slice**, never the operator-session slice.
|
|
18
|
-
- **In-run axis:** multiple agents coordinated inside a single session/run. Even
|
|
19
|
-
here our own machinery remains necessary because Agent Teams provides **no
|
|
20
|
-
automatic isolation**: file-scope deconfliction (`skills/session-plan/SKILL.md` —
|
|
21
|
-
"verify that NO two agents in the same wave modify the same file") plus
|
|
22
|
-
`withStateMdLock` STATE.md serialization still do the work Teams does not.
|
|
23
|
-
|
|
24
|
-
PSA-005 spans **both** axes; only its session-lock half is purely
|
|
25
|
-
operator-scoped. PSA-006 is **orthogonal** to both (Discovery grep-discipline).
|
|
26
|
-
See ADR-0010 § Native-Overlap Refresh (Agent Teams = Adapter; PSA re-scoped).
|
|
27
|
-
|
|
28
|
-
## Recognizing Parallel Work (PSA-001: Detect Before Acting)
|
|
29
|
-
|
|
30
|
-
*Axis: operator-session safety — the durable moat Agent Teams structurally cannot enter (per-process / in-run only).*
|
|
31
|
-
|
|
32
|
-
- **Unexpected git status changes:** Files modified or staged that are not part of your current task likely belong to another session.
|
|
33
|
-
- **Unfamiliar commits:** New entries in `git log` that you did not create mean another agent (or the user manually) committed work.
|
|
34
|
-
- **Spontaneous errors:** Build failures, type errors, or test failures in code you did not touch may be in-progress work from another session — not pre-existing bugs.
|
|
35
|
-
- **Files changed between reads:** If a file's content differs from what you read moments ago, another session likely edited it.
|
|
36
|
-
- **New untracked files:** Files appearing in `git status` that you did not create belong to someone else's work.
|
|
37
|
-
|
|
38
|
-
## Behavioral Guidance (PSA-002: Ask, Don't Assume)
|
|
39
|
-
|
|
40
|
-
*Axis: operator-session safety — the durable moat Agent Teams structurally cannot enter (per-process / in-run only).*
|
|
41
|
-
|
|
42
|
-
- **When you detect signs of parallel work, stop and ask the user:** "I notice changes I didn't make (e.g., modified files in git status, new commits). Is another session active?"
|
|
43
|
-
- **Never "fix" code outside your task scope.** Errors in files you are not working on may be intentional intermediate states from another session.
|
|
44
|
-
- **Stay in your lane.** Only read, create, modify, and delete files directly relevant to your assigned task.
|
|
45
|
-
- **If blocked by external changes, ask the user** rather than reverting, resetting, or working around them.
|
|
46
|
-
- **Track your own footprint.** Be aware of which files you have created or modified. Your commits should contain only your changes.
|
|
47
|
-
|
|
48
|
-
## Destructive Action Safeguards (PSA-003: Never Destroy What You Didn't Create)
|
|
49
|
-
|
|
50
|
-
*Axis: operator-session safety — the durable moat Agent Teams structurally cannot enter (per-process / in-run only).*
|
|
51
|
-
|
|
52
|
-
These commands require explicit user confirmation even in normal operation. When parallel work is suspected, they are **forbidden** without user approval:
|
|
53
|
-
- **`git reset` (any form)** — destroys staged or committed work that may belong to another session.
|
|
54
|
-
- **`git checkout -- <file>`** — discards uncommitted changes another session is actively building.
|
|
55
|
-
- **`git clean -f`** — deletes untracked files another session created.
|
|
56
|
-
- **`git stash`** — captures another session's changes into a stash they cannot find.
|
|
57
|
-
- **`rm` / delete of files you did not create** — may remove work-in-progress from another session.
|
|
58
|
-
- **`git revert` of commits you did not make** — undoes another session's completed work.
|
|
59
|
-
- **`git push --force`** — rewrites shared history (dangerous even without parallel sessions).
|
|
60
|
-
|
|
61
|
-
Before running any of the above, ask: "Did I create this file/commit/change? If not, it is not mine to touch."
|
|
62
|
-
|
|
63
|
-
## Commit Discipline (PSA-004: Isolate Your Changes)
|
|
64
|
-
|
|
65
|
-
*Axis: operator-session safety — the durable moat Agent Teams structurally cannot enter (per-process / in-run only).*
|
|
66
|
-
|
|
67
|
-
- **Stage files individually** (`git add <file>`) rather than `git add .` or `git add -A`, which may sweep in another session's work.
|
|
68
|
-
- **Review `git diff --cached` before committing** to verify every staged change is yours.
|
|
69
|
-
- **If you see unfamiliar changes in the diff, unstage them** and ask the user.
|
|
70
|
-
- **Never amend a commit you did not create.**
|
|
71
|
-
|
|
72
|
-
## Anti-Patterns
|
|
73
|
-
- Seeing unfamiliar changes and assuming they are "leftover mess" to clean up — they are likely active work.
|
|
74
|
-
- Running `git reset --hard` to "start fresh" — this destroys all uncommitted work across all sessions.
|
|
75
|
-
- Fixing type errors or lint issues in files outside your scope — the other session will handle their own files.
|
|
76
|
-
- Using `git add .` in a shared workspace — you will commit another session's partial work.
|
|
77
|
-
- Reverting "broken" commits without asking — another session may have intentionally pushed incremental progress.
|