@openrig/cli 0.5.6 → 0.5.8
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/daemon/assets/plugins/openrig-core/README.md +1 -1
- package/daemon/assets/plugins/openrig-core/hooks/scripts/refocus.cjs +25 -2
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/precompact-hook.mjs +95 -8
- package/daemon/assets/plugins/openrig-core/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +9 -1
- package/daemon/assets/plugins/openrig-core/skills/loading-addressable-markdown/SKILL.md +34 -0
- package/daemon/assets/plugins/openrig-core/skills/loading-addressable-markdown/scripts/resolve-markdown.mjs +170 -0
- package/daemon/assets/plugins/openrig-core/skills/openrig-skills/SKILL.md +1 -4
- package/daemon/assets/plugins/openrig-core/skills/retiring-and-inheriting-a-seat/SKILL.md +3 -3
- package/daemon/assets/plugins/openrig-core/skills/software-for-agents/SKILL.md +4 -9
- package/daemon/assets/vm-preview-fixtures/workflows/sample-basic-loop.yaml +3 -3
- package/daemon/context-packs/onboarding-width/manifest.yaml +1 -1
- package/daemon/context-packs/onboarding-width/public-what-you-can-do.md +40 -15
- package/daemon/context-packs/skills/applying-a-permission-policy/SKILL.md +120 -0
- package/daemon/context-packs/skills/applying-a-permission-policy/manifest.yaml +10 -0
- package/daemon/context-packs/skills/claude-compaction-restore/SKILL.md +166 -0
- package/daemon/context-packs/skills/claude-compaction-restore/manifest.yaml +18 -0
- package/daemon/context-packs/skills/claude-compaction-restore/scripts/precompact-hook.mjs +261 -0
- package/daemon/context-packs/skills/claude-compaction-restore/scripts/restore-from-jsonl.mjs +495 -0
- package/daemon/context-packs/skills/claude-compaction-restore/templates/compact-instruction.md +1 -0
- package/daemon/context-packs/skills/claude-compaction-restore/templates/post-compact-restore-instruction.md +1 -0
- package/daemon/context-packs/skills/core/agent-starters/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/SKILL.md +1 -1
- package/daemon/context-packs/skills/core/agent-startup-and-context-ingestion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/cross-host-rig-commands/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/human-in-the-loop/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/messaging-the-human/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-architect/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-cmux/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-herdr/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-skills/SKILL.md +1 -4
- package/daemon/context-packs/skills/core/openrig-skills/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/openrig-upgrade/SKILL.md +120 -355
- package/daemon/context-packs/skills/core/openrig-upgrade/manifest.yaml +9 -3
- package/daemon/context-packs/skills/core/openrig-upgrade/scripts/backup-sqlite.mjs +62 -0
- package/daemon/context-packs/skills/core/openrig-upgrade/scripts/inspect-upgrade.mjs +40 -0
- package/daemon/context-packs/skills/core/openrig-upgrade/scripts/refresh-managed-plugin.mjs +151 -0
- package/daemon/context-packs/skills/core/rig-bundles-and-shareable-artifacts/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/rig-lifecycle/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/session-source-fork/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/specification-system/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/topology-mutation-and-seat-management/manifest.yaml +1 -1
- package/daemon/context-packs/skills/core/watchdog/manifest.yaml +1 -1
- package/daemon/context-packs/skills/delegating-work/SKILL.md +43 -0
- package/daemon/context-packs/skills/delegating-work/manifest.yaml +10 -0
- package/daemon/context-packs/skills/forming-an-openrig-mental-model/SKILL.md +318 -0
- package/daemon/context-packs/skills/forming-an-openrig-mental-model/manifest.yaml +10 -0
- package/daemon/context-packs/skills/loading-addressable-markdown/SKILL.md +34 -0
- package/daemon/context-packs/skills/loading-addressable-markdown/manifest.yaml +12 -0
- package/daemon/context-packs/skills/loading-addressable-markdown/scripts/resolve-markdown.mjs +170 -0
- package/daemon/context-packs/skills/mission-slice-sop/SKILL.md +94 -0
- package/daemon/context-packs/skills/mission-slice-sop/manifest.yaml +10 -0
- package/daemon/context-packs/skills/openrig-operating-model/SKILL.md +397 -0
- package/daemon/context-packs/skills/openrig-operating-model/manifest.yaml +30 -0
- package/daemon/context-packs/skills/openrig-operating-model/scripts/compose.py +572 -0
- package/daemon/context-packs/skills/openrig-operating-model/scripts/scaffold.sh +34 -0
- package/daemon/context-packs/skills/openrig-operating-model/scripts/trace-due.sh +32 -0
- package/daemon/context-packs/skills/openrig-operating-model/scripts/trace-stamp.sh +5 -0
- package/daemon/context-packs/skills/openrig-operating-model/scripts/trunk-diff.sh +18 -0
- package/daemon/context-packs/skills/openrig-operating-model/templates/LEARNED.md +40 -0
- package/daemon/context-packs/skills/openrig-operating-model/templates/NOTES.md +9 -0
- package/daemon/context-packs/skills/openrig-operating-model/templates/PLAYBOOK.md +5 -0
- package/daemon/context-packs/skills/openrig-operating-model/templates/SOP.md +24 -0
- package/daemon/context-packs/skills/openrig-operating-model/templates/SPEC.md +54 -0
- package/daemon/context-packs/skills/openrig-user/SKILL.md +1374 -0
- package/daemon/context-packs/skills/openrig-user/manifest.yaml +10 -0
- package/daemon/context-packs/skills/orienting-to-an-inherited-seat/CHANGELOG.md +64 -0
- package/daemon/context-packs/skills/orienting-to-an-inherited-seat/SKILL.md +250 -0
- package/daemon/context-packs/skills/orienting-to-an-inherited-seat/manifest.yaml +12 -0
- package/daemon/context-packs/skills/pm/backlog-capture/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/context-builder/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/exec-summary/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/office-hours/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/plan-review/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pm/requirements-writer/SKILL.md +21 -15
- package/daemon/context-packs/skills/pm/requirements-writer/manifest.yaml +3 -3
- package/daemon/context-packs/skills/pm/ui-mockup/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/development-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/orchestration-team/SKILL.md +1 -1
- package/daemon/context-packs/skills/pods/orchestration-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/oversight-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/pods/review-team/SKILL.md +1 -1
- package/daemon/context-packs/skills/pods/review-team/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/agent-browser/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/context-engineering/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/dogfood/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/frontend-design/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/systematic-debugging/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/test-driven-development/manifest.yaml +1 -1
- package/daemon/context-packs/skills/process/verification-before-completion/manifest.yaml +1 -1
- package/daemon/context-packs/skills/queue-handoff/SKILL.md +192 -0
- package/daemon/context-packs/skills/queue-handoff/manifest.yaml +10 -0
- package/daemon/context-packs/skills/refocusing/SKILL.md +31 -0
- package/daemon/context-packs/skills/refocusing/manifest.yaml +14 -0
- package/daemon/context-packs/skills/refocusing/references/refocus.md +22 -0
- package/daemon/context-packs/skills/refocusing/scripts/trace-to-root.py +264 -0
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/CHANGELOG.md +48 -0
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/SKILL.md +231 -0
- package/daemon/context-packs/skills/retiring-and-inheriting-a-seat/manifest.yaml +12 -0
- package/daemon/context-packs/skills/seat-continuity-and-handover/SKILL.md +151 -0
- package/daemon/context-packs/skills/seat-continuity-and-handover/manifest.yaml +16 -0
- package/daemon/context-packs/skills/seat-continuity-and-handover/references/apprentice-evidence-toolkit.md +32 -0
- package/daemon/context-packs/skills/seat-continuity-and-handover/references/apprentice-successor-seat-cutover.md +256 -0
- package/daemon/context-packs/skills/seat-continuity-and-handover/references/orchestrator-role.md +40 -0
- package/daemon/context-packs/skills/session-compaction-and-restore/SKILL.md +163 -0
- package/daemon/context-packs/skills/session-compaction-and-restore/manifest.yaml +10 -0
- package/daemon/context-packs/skills/software-for-agents/SKILL.md +187 -0
- package/daemon/context-packs/skills/software-for-agents/manifest.yaml +10 -0
- package/daemon/context-packs/world-example/manifest.yaml +1 -1
- package/daemon/context-packs/world-public/manifest.yaml +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/daemon/dist/adapters/codex-runtime-adapter.js +249 -2
- package/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/daemon/dist/adapters/tmux.d.ts +6 -5
- package/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/daemon/dist/adapters/tmux.js +29 -12
- package/daemon/dist/adapters/tmux.js.map +1 -1
- package/daemon/dist/build-info.js +3 -3
- package/daemon/dist/builtins/workflow-specs/basic-loop.yaml +3 -3
- package/daemon/dist/builtins/workflow-specs/conveyor.yaml +1 -1
- package/daemon/dist/builtins/workflow-specs/factory-rsi.yaml +1 -1
- package/daemon/dist/db/all-migrations.d.ts +1 -1
- package/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/daemon/dist/db/all-migrations.js +6 -2
- package/daemon/dist/db/all-migrations.js.map +1 -1
- package/daemon/dist/db/migrations/077_node_session_source.d.ts +4 -0
- package/daemon/dist/db/migrations/077_node_session_source.d.ts.map +1 -0
- package/daemon/dist/db/migrations/077_node_session_source.js +6 -0
- package/daemon/dist/db/migrations/077_node_session_source.js.map +1 -0
- package/daemon/dist/db/migrations/078_idle_gate_fired_condition.d.ts +17 -0
- package/daemon/dist/db/migrations/078_idle_gate_fired_condition.d.ts.map +1 -0
- package/daemon/dist/db/migrations/078_idle_gate_fired_condition.js +21 -0
- package/daemon/dist/db/migrations/078_idle_gate_fired_condition.js.map +1 -0
- package/daemon/dist/domain/active-occupant.d.ts +6 -0
- package/daemon/dist/domain/active-occupant.d.ts.map +1 -1
- package/daemon/dist/domain/active-occupant.js +14 -0
- package/daemon/dist/domain/active-occupant.js.map +1 -1
- package/daemon/dist/domain/context-packs/manifest-parser.d.ts.map +1 -1
- package/daemon/dist/domain/context-packs/manifest-parser.js +5 -6
- package/daemon/dist/domain/context-packs/manifest-parser.js.map +1 -1
- package/daemon/dist/domain/context-packs/profile-composer.d.ts +1 -1
- package/daemon/dist/domain/context-packs/profile-composer.d.ts.map +1 -1
- package/daemon/dist/domain/context-packs/profile-composer.js +2 -2
- package/daemon/dist/domain/context-packs/profile-composer.js.map +1 -1
- package/daemon/dist/domain/context-packs/profile-source-resolver.d.ts +3 -1
- package/daemon/dist/domain/context-packs/profile-source-resolver.d.ts.map +1 -1
- package/daemon/dist/domain/context-packs/profile-source-resolver.js +3 -2
- package/daemon/dist/domain/context-packs/profile-source-resolver.js.map +1 -1
- package/daemon/dist/domain/current-work.d.ts +73 -0
- package/daemon/dist/domain/current-work.d.ts.map +1 -0
- package/daemon/dist/domain/current-work.js +225 -0
- package/daemon/dist/domain/current-work.js.map +1 -0
- package/daemon/dist/domain/execution-view.d.ts.map +1 -1
- package/daemon/dist/domain/execution-view.js +215 -13
- package/daemon/dist/domain/execution-view.js.map +1 -1
- package/daemon/dist/domain/gateway/human-registry.d.ts +3 -2
- package/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
- package/daemon/dist/domain/gateway/human-registry.js +113 -18
- package/daemon/dist/domain/gateway/human-registry.js.map +1 -1
- package/daemon/dist/domain/model-divergence/effective-model-readers.d.ts +3 -2
- package/daemon/dist/domain/model-divergence/effective-model-readers.d.ts.map +1 -1
- package/daemon/dist/domain/model-divergence/effective-model-readers.js +7 -5
- package/daemon/dist/domain/model-divergence/effective-model-readers.js.map +1 -1
- package/daemon/dist/domain/policies/idle-gate-qitem.d.ts +5 -5
- package/daemon/dist/domain/policies/idle-gate-qitem.d.ts.map +1 -1
- package/daemon/dist/domain/policies/idle-gate-qitem.js +130 -22
- package/daemon/dist/domain/policies/idle-gate-qitem.js.map +1 -1
- package/daemon/dist/domain/policies/types.d.ts +12 -0
- package/daemon/dist/domain/policies/types.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.d.ts +37 -2
- package/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-repository.js +171 -16
- package/daemon/dist/domain/queue-repository.js.map +1 -1
- package/daemon/dist/domain/queue-wake-repository.d.ts +19 -0
- package/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
- package/daemon/dist/domain/queue-wake-repository.js +33 -0
- package/daemon/dist/domain/queue-wake-repository.js.map +1 -1
- package/daemon/dist/domain/reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/reconciler.js +4 -1
- package/daemon/dist/domain/reconciler.js.map +1 -1
- package/daemon/dist/domain/rehydrate-eligibility.d.ts +11 -1
- package/daemon/dist/domain/rehydrate-eligibility.d.ts.map +1 -1
- package/daemon/dist/domain/rehydrate-eligibility.js +34 -0
- package/daemon/dist/domain/rehydrate-eligibility.js.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.d.ts +9 -0
- package/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/daemon/dist/domain/restore-orchestrator.js +32 -0
- package/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/daemon/dist/domain/restore-plan-preview.js +2 -2
- package/daemon/dist/domain/restore-plan-preview.js.map +1 -1
- package/daemon/dist/domain/rig-lifecycle-service.d.ts +24 -4
- package/daemon/dist/domain/rig-lifecycle-service.d.ts.map +1 -1
- package/daemon/dist/domain/rig-lifecycle-service.js +116 -6
- package/daemon/dist/domain/rig-lifecycle-service.js.map +1 -1
- package/daemon/dist/domain/rig-repository.d.ts +2 -1
- package/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/daemon/dist/domain/rig-repository.js +7 -0
- package/daemon/dist/domain/rig-repository.js.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-exporter.js +4 -0
- package/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.d.ts +15 -9
- package/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-instantiator.js +68 -83
- package/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/daemon/dist/domain/rigspec-schema.d.ts +5 -1
- package/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/daemon/dist/domain/rigspec-schema.js +41 -2
- package/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.d.ts +32 -1
- package/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
- package/daemon/dist/domain/seat-attention-reconciler.js +183 -4
- package/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
- package/daemon/dist/domain/session-transport.d.ts +5 -0
- package/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/daemon/dist/domain/session-transport.js +33 -7
- package/daemon/dist/domain/session-transport.js.map +1 -1
- package/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
- package/daemon/dist/domain/snapshot-capture.js +4 -2
- package/daemon/dist/domain/snapshot-capture.js.map +1 -1
- package/daemon/dist/domain/topology-defaults-installer.d.ts +4 -2
- package/daemon/dist/domain/topology-defaults-installer.d.ts.map +1 -1
- package/daemon/dist/domain/topology-defaults-installer.js +27 -0
- package/daemon/dist/domain/topology-defaults-installer.js.map +1 -1
- package/daemon/dist/domain/types.d.ts +3 -1
- package/daemon/dist/domain/types.d.ts.map +1 -1
- package/daemon/dist/domain/types.js.map +1 -1
- package/daemon/dist/domain/up-command-router.d.ts.map +1 -1
- package/daemon/dist/domain/up-command-router.js +19 -0
- package/daemon/dist/domain/up-command-router.js.map +1 -1
- package/daemon/dist/domain/watchdog-jobs-repository.d.ts +9 -0
- package/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-jobs-repository.js +15 -2
- package/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.d.ts +7 -0
- package/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
- package/daemon/dist/domain/watchdog-policy-engine.js +47 -0
- package/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js +37 -2
- package/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
- package/daemon/dist/routes/context-packs.d.ts.map +1 -1
- package/daemon/dist/routes/context-packs.js +146 -6
- package/daemon/dist/routes/context-packs.js.map +1 -1
- package/daemon/dist/routes/queue.d.ts.map +1 -1
- package/daemon/dist/routes/queue.js +31 -10
- package/daemon/dist/routes/queue.js.map +1 -1
- package/daemon/dist/routes/rigs.js +17 -6
- package/daemon/dist/routes/rigs.js.map +1 -1
- package/daemon/dist/routes/rigspec.d.ts.map +1 -1
- package/daemon/dist/routes/rigspec.js +37 -0
- package/daemon/dist/routes/rigspec.js.map +1 -1
- package/daemon/dist/routes/sessions.js +7 -3
- package/daemon/dist/routes/sessions.js.map +1 -1
- package/daemon/dist/routes/up.js +10 -3
- package/daemon/dist/routes/up.js.map +1 -1
- package/daemon/dist/startup.d.ts.map +1 -1
- package/daemon/dist/startup.js +19 -7
- package/daemon/dist/startup.js.map +1 -1
- package/daemon/docs/reference/agent-spec.md +34 -1
- package/daemon/docs/reference/chain-file-convention.md +17 -12
- package/daemon/docs/reference/mission-install.md +23 -2
- package/daemon/docs/reference/product-journey-sdlc.md +305 -0
- package/daemon/docs/reference/release-boundary.md +29 -5
- package/daemon/docs/reference/sdlc-conventions.md +15 -2
- package/daemon/specs/agents/apps/vault-specialist/agent.yaml +1 -1
- package/daemon/specs/agents/apps/vault-specialist/guidance/role.md +0 -1
- package/daemon/specs/agents/conveyor/builder/agent.yaml +1 -1
- package/daemon/specs/agents/conveyor/builder/guidance/role.md +0 -1
- package/daemon/specs/agents/conveyor/lead/agent.yaml +1 -1
- package/daemon/specs/agents/conveyor/lead/guidance/role.md +0 -3
- package/daemon/specs/agents/conveyor/planner/agent.yaml +1 -1
- package/daemon/specs/agents/conveyor/planner/guidance/role.md +0 -1
- package/daemon/specs/agents/design/product-designer/agent.yaml +3 -4
- package/daemon/specs/agents/design/product-designer/guidance/role.md +0 -3
- package/daemon/specs/agents/development/implementer/agent.yaml +3 -4
- package/daemon/specs/agents/development/implementer/guidance/role.md +0 -3
- package/daemon/specs/agents/development/qa/agent.yaml +4 -4
- package/daemon/specs/agents/development/qa/guidance/role.md +1 -4
- package/daemon/specs/agents/factory-rsi/dogfood/agent.yaml +1 -1
- package/daemon/specs/agents/factory-rsi/release-manager/agent.yaml +1 -1
- package/daemon/specs/agents/orchestration/orchestrator/agent.yaml +3 -4
- package/daemon/specs/agents/orchestration/orchestrator/guidance/role.md +0 -4
- package/daemon/specs/agents/review/independent-reviewer/agent.yaml +3 -4
- package/daemon/specs/agents/review/independent-reviewer/guidance/role.md +0 -3
- package/daemon/specs/agents/shared/agent.yaml +2 -10
- package/daemon/specs/agents/shared/skills/core/agent-startup-and-context-ingestion/SKILL.md +1 -1
- package/daemon/specs/agents/shared/skills/core/openrig-skills/SKILL.md +1 -4
- package/daemon/specs/agents/shared/skills/core/openrig-upgrade/SKILL.md +120 -355
- package/daemon/specs/agents/shared/skills/core/openrig-upgrade/scripts/backup-sqlite.mjs +62 -0
- package/daemon/specs/agents/shared/skills/core/openrig-upgrade/scripts/inspect-upgrade.mjs +40 -0
- package/daemon/specs/agents/shared/skills/core/openrig-upgrade/scripts/refresh-managed-plugin.mjs +151 -0
- package/daemon/specs/agents/shared/skills/pm/requirements-writer/SKILL.md +21 -15
- package/daemon/specs/agents/shared/skills/pods/orchestration-team/SKILL.md +1 -1
- package/daemon/specs/agents/shared/skills/pods/review-team/SKILL.md +1 -1
- package/daemon/specs/rigs/launch/kernel/agents/advisor/lead/agent.yaml +1 -1
- package/daemon/specs/rigs/launch/kernel/agents/advisor/lead/guidance/role.md +2 -3
- package/daemon/specs/rigs/preview/product-team/topology/instance/CRAFT.md +4 -4
- package/daemon/specs/rigs/preview/product-team/topology/rig/ORCHESTRATION-CRAFT.md +3 -3
- package/dist/build-info.js +3 -3
- package/dist/commands/config-init-workspace.d.ts.map +1 -1
- package/dist/commands/config-init-workspace.js +38 -3
- package/dist/commands/config-init-workspace.js.map +1 -1
- package/dist/commands/context.d.ts.map +1 -1
- package/dist/commands/context.js +90 -7
- package/dist/commands/context.js.map +1 -1
- package/dist/commands/create.d.ts +4 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +84 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/grow.d.ts +4 -0
- package/dist/commands/grow.d.ts.map +1 -0
- package/dist/commands/grow.js +182 -0
- package/dist/commands/grow.js.map +1 -0
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +27 -1
- package/dist/commands/import.js.map +1 -1
- package/dist/commands/remove.d.ts.map +1 -1
- package/dist/commands/remove.js +9 -1
- package/dist/commands/remove.js.map +1 -1
- package/dist/commands/rig.d.ts.map +1 -1
- package/dist/commands/rig.js +48 -1
- package/dist/commands/rig.js.map +1 -1
- package/dist/commands/scope.d.ts.map +1 -1
- package/dist/commands/scope.js +21 -2
- package/dist/commands/scope.js.map +1 -1
- package/dist/commands/shrink.d.ts.map +1 -1
- package/dist/commands/shrink.js +6 -1
- package/dist/commands/shrink.js.map +1 -1
- package/dist/commands/topology-default-agent.d.ts +4 -0
- package/dist/commands/topology-default-agent.d.ts.map +1 -0
- package/dist/commands/topology-default-agent.js +13 -0
- package/dist/commands/topology-default-agent.js.map +1 -0
- package/dist/commands/walk.d.ts.map +1 -1
- package/dist/commands/walk.js +3 -0
- package/dist/commands/walk.js.map +1 -1
- package/dist/commands/watchdog.d.ts.map +1 -1
- package/dist/commands/watchdog.js +51 -3
- package/dist/commands/watchdog.js.map +1 -1
- package/dist/front-door.d.ts.map +1 -1
- package/dist/front-door.js +16 -4
- package/dist/front-door.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/topology-trace.d.ts +3 -2
- package/dist/lib/topology-trace.d.ts.map +1 -1
- package/dist/lib/topology-trace.js +12 -2
- package/dist/lib/topology-trace.js.map +1 -1
- package/dist/lib/work-install.d.ts +39 -0
- package/dist/lib/work-install.d.ts.map +1 -0
- package/dist/lib/work-install.js +312 -0
- package/dist/lib/work-install.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/adapters/codex-runtime-adapter.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/adapters/codex-runtime-adapter.js +249 -2
- package/node_modules/@openrig/daemon/dist/adapters/codex-runtime-adapter.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/adapters/tmux.d.ts +6 -5
- package/node_modules/@openrig/daemon/dist/adapters/tmux.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/adapters/tmux.js +29 -12
- package/node_modules/@openrig/daemon/dist/adapters/tmux.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/build-info.js +3 -3
- package/node_modules/@openrig/daemon/dist/builtins/workflow-specs/basic-loop.yaml +3 -3
- package/node_modules/@openrig/daemon/dist/builtins/workflow-specs/conveyor.yaml +1 -1
- package/node_modules/@openrig/daemon/dist/builtins/workflow-specs/factory-rsi.yaml +1 -1
- package/node_modules/@openrig/daemon/dist/db/all-migrations.d.ts +1 -1
- package/node_modules/@openrig/daemon/dist/db/all-migrations.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/db/all-migrations.js +6 -2
- package/node_modules/@openrig/daemon/dist/db/all-migrations.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/db/migrations/077_node_session_source.d.ts +4 -0
- package/node_modules/@openrig/daemon/dist/db/migrations/077_node_session_source.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/db/migrations/077_node_session_source.js +6 -0
- package/node_modules/@openrig/daemon/dist/db/migrations/077_node_session_source.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/db/migrations/078_idle_gate_fired_condition.d.ts +17 -0
- package/node_modules/@openrig/daemon/dist/db/migrations/078_idle_gate_fired_condition.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/db/migrations/078_idle_gate_fired_condition.js +21 -0
- package/node_modules/@openrig/daemon/dist/db/migrations/078_idle_gate_fired_condition.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/active-occupant.d.ts +6 -0
- package/node_modules/@openrig/daemon/dist/domain/active-occupant.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/active-occupant.js +14 -0
- package/node_modules/@openrig/daemon/dist/domain/active-occupant.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/manifest-parser.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/manifest-parser.js +5 -6
- package/node_modules/@openrig/daemon/dist/domain/context-packs/manifest-parser.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.d.ts +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.js +2 -2
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-composer.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.d.ts +3 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.js +3 -2
- package/node_modules/@openrig/daemon/dist/domain/context-packs/profile-source-resolver.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/current-work.d.ts +73 -0
- package/node_modules/@openrig/daemon/dist/domain/current-work.d.ts.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/current-work.js +225 -0
- package/node_modules/@openrig/daemon/dist/domain/current-work.js.map +1 -0
- package/node_modules/@openrig/daemon/dist/domain/execution-view.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/execution-view.js +215 -13
- package/node_modules/@openrig/daemon/dist/domain/execution-view.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.d.ts +3 -2
- package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.js +113 -18
- package/node_modules/@openrig/daemon/dist/domain/gateway/human-registry.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/effective-model-readers.d.ts +3 -2
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/effective-model-readers.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/effective-model-readers.js +7 -5
- package/node_modules/@openrig/daemon/dist/domain/model-divergence/effective-model-readers.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/policies/idle-gate-qitem.d.ts +5 -5
- package/node_modules/@openrig/daemon/dist/domain/policies/idle-gate-qitem.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/policies/idle-gate-qitem.js +130 -22
- package/node_modules/@openrig/daemon/dist/domain/policies/idle-gate-qitem.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/policies/types.d.ts +12 -0
- package/node_modules/@openrig/daemon/dist/domain/policies/types.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/queue-repository.d.ts +37 -2
- package/node_modules/@openrig/daemon/dist/domain/queue-repository.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/queue-repository.js +171 -16
- package/node_modules/@openrig/daemon/dist/domain/queue-repository.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/queue-wake-repository.d.ts +19 -0
- package/node_modules/@openrig/daemon/dist/domain/queue-wake-repository.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/queue-wake-repository.js +33 -0
- package/node_modules/@openrig/daemon/dist/domain/queue-wake-repository.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/reconciler.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/reconciler.js +4 -1
- package/node_modules/@openrig/daemon/dist/domain/reconciler.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rehydrate-eligibility.d.ts +11 -1
- package/node_modules/@openrig/daemon/dist/domain/rehydrate-eligibility.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rehydrate-eligibility.js +34 -0
- package/node_modules/@openrig/daemon/dist/domain/rehydrate-eligibility.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/restore-orchestrator.d.ts +9 -0
- package/node_modules/@openrig/daemon/dist/domain/restore-orchestrator.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/restore-orchestrator.js +32 -0
- package/node_modules/@openrig/daemon/dist/domain/restore-orchestrator.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/restore-plan-preview.js +2 -2
- package/node_modules/@openrig/daemon/dist/domain/restore-plan-preview.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rig-lifecycle-service.d.ts +24 -4
- package/node_modules/@openrig/daemon/dist/domain/rig-lifecycle-service.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rig-lifecycle-service.js +116 -6
- package/node_modules/@openrig/daemon/dist/domain/rig-lifecycle-service.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rig-repository.d.ts +2 -1
- package/node_modules/@openrig/daemon/dist/domain/rig-repository.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rig-repository.js +7 -0
- package/node_modules/@openrig/daemon/dist/domain/rig-repository.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-exporter.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-exporter.js +4 -0
- package/node_modules/@openrig/daemon/dist/domain/rigspec-exporter.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.d.ts +15 -9
- package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.js +68 -83
- package/node_modules/@openrig/daemon/dist/domain/rigspec-instantiator.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.d.ts +5 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.js +41 -2
- package/node_modules/@openrig/daemon/dist/domain/rigspec-schema.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/seat-attention-reconciler.d.ts +32 -1
- package/node_modules/@openrig/daemon/dist/domain/seat-attention-reconciler.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/seat-attention-reconciler.js +183 -4
- package/node_modules/@openrig/daemon/dist/domain/seat-attention-reconciler.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/session-transport.d.ts +5 -0
- package/node_modules/@openrig/daemon/dist/domain/session-transport.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/session-transport.js +33 -7
- package/node_modules/@openrig/daemon/dist/domain/session-transport.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/snapshot-capture.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/snapshot-capture.js +4 -2
- package/node_modules/@openrig/daemon/dist/domain/snapshot-capture.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.d.ts +4 -2
- package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.js +27 -0
- package/node_modules/@openrig/daemon/dist/domain/topology-defaults-installer.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/types.d.ts +3 -1
- package/node_modules/@openrig/daemon/dist/domain/types.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/types.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/up-command-router.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/up-command-router.js +19 -0
- package/node_modules/@openrig/daemon/dist/domain/up-command-router.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/watchdog-jobs-repository.d.ts +9 -0
- package/node_modules/@openrig/daemon/dist/domain/watchdog-jobs-repository.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/watchdog-jobs-repository.js +15 -2
- package/node_modules/@openrig/daemon/dist/domain/watchdog-jobs-repository.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/watchdog-policy-engine.d.ts +7 -0
- package/node_modules/@openrig/daemon/dist/domain/watchdog-policy-engine.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/watchdog-policy-engine.js +47 -0
- package/node_modules/@openrig/daemon/dist/domain/watchdog-policy-engine.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workspace/default-workspace-scaffold.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/domain/workspace/default-workspace-scaffold.js +37 -2
- package/node_modules/@openrig/daemon/dist/domain/workspace/default-workspace-scaffold.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/context-packs.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/context-packs.js +146 -6
- package/node_modules/@openrig/daemon/dist/routes/context-packs.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/queue.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/queue.js +31 -10
- package/node_modules/@openrig/daemon/dist/routes/queue.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/rigs.js +17 -6
- package/node_modules/@openrig/daemon/dist/routes/rigs.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/rigspec.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/rigspec.js +37 -0
- package/node_modules/@openrig/daemon/dist/routes/rigspec.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/sessions.js +7 -3
- package/node_modules/@openrig/daemon/dist/routes/sessions.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/routes/up.js +10 -3
- package/node_modules/@openrig/daemon/dist/routes/up.js.map +1 -1
- package/node_modules/@openrig/daemon/dist/startup.d.ts.map +1 -1
- package/node_modules/@openrig/daemon/dist/startup.js +19 -7
- package/node_modules/@openrig/daemon/dist/startup.js.map +1 -1
- package/node_modules/@openrig/daemon/package.json +1 -1
- package/package.json +2 -1
- package/tui/dist/daemon-client.d.ts +2 -0
- package/tui/dist/daemon-client.d.ts.map +1 -1
- package/tui/dist/daemon-client.js +4 -0
- package/tui/dist/daemon-client.js.map +1 -1
- package/tui/dist/execution/execution-model.d.ts +19 -0
- package/tui/dist/execution/execution-model.d.ts.map +1 -0
- package/tui/dist/execution/execution-model.js +518 -0
- package/tui/dist/execution/execution-model.js.map +1 -0
- package/tui/dist/hydrate.d.ts +1 -1
- package/tui/dist/hydrate.d.ts.map +1 -1
- package/tui/dist/hydrate.js +6 -2
- package/tui/dist/hydrate.js.map +1 -1
- package/tui/dist/input.d.ts +7 -0
- package/tui/dist/input.d.ts.map +1 -1
- package/tui/dist/input.js +13 -0
- package/tui/dist/input.js.map +1 -1
- package/tui/dist/live.d.ts +10 -0
- package/tui/dist/live.d.ts.map +1 -1
- package/tui/dist/live.js +34 -1
- package/tui/dist/live.js.map +1 -1
- package/tui/dist/main.js +22 -3
- package/tui/dist/main.js.map +1 -1
- package/tui/dist/render.d.ts.map +1 -1
- package/tui/dist/render.js +13 -2
- package/tui/dist/render.js.map +1 -1
- package/tui/dist/scopes/scopes-model.d.ts +1 -0
- package/tui/dist/scopes/scopes-model.d.ts.map +1 -1
- package/tui/dist/scopes/scopes-model.js +4 -2
- package/tui/dist/scopes/scopes-model.js.map +1 -1
- package/tui/dist/sections.js +2 -2
- package/tui/dist/sections.js.map +1 -1
- package/tui/dist/state.d.ts.map +1 -1
- package/tui/dist/state.js +15 -2
- package/tui/dist/state.js.map +1 -1
- package/tui/dist/stylize.js +2 -2
- package/tui/dist/stylize.js.map +1 -1
- package/tui/dist/types.d.ts +20 -0
- package/tui/dist/types.d.ts.map +1 -1
- package/daemon/context-packs/skills/process/brainstorming/OPENRIG.md +0 -48
- package/daemon/context-packs/skills/process/brainstorming/SKILL.md +0 -107
- package/daemon/context-packs/skills/process/brainstorming/manifest.yaml +0 -12
- package/daemon/context-packs/skills/process/executing-plans/OPENRIG.md +0 -56
- package/daemon/context-packs/skills/process/executing-plans/SKILL.md +0 -94
- package/daemon/context-packs/skills/process/executing-plans/manifest.yaml +0 -12
- package/daemon/context-packs/skills/process/using-superpowers/OPENRIG.md +0 -48
- package/daemon/context-packs/skills/process/using-superpowers/SKILL.md +0 -106
- package/daemon/context-packs/skills/process/using-superpowers/manifest.yaml +0 -12
- package/daemon/context-packs/skills/process/writing-plans/OPENRIG.md +0 -52
- package/daemon/context-packs/skills/process/writing-plans/SKILL.md +0 -126
- package/daemon/context-packs/skills/process/writing-plans/manifest.yaml +0 -12
- package/daemon/specs/agents/shared/skills/process/brainstorming/OPENRIG.md +0 -48
- package/daemon/specs/agents/shared/skills/process/brainstorming/SKILL.md +0 -107
- package/daemon/specs/agents/shared/skills/process/executing-plans/OPENRIG.md +0 -56
- package/daemon/specs/agents/shared/skills/process/executing-plans/SKILL.md +0 -94
- package/daemon/specs/agents/shared/skills/process/using-superpowers/OPENRIG.md +0 -48
- package/daemon/specs/agents/shared/skills/process/using-superpowers/SKILL.md +0 -106
- package/daemon/specs/agents/shared/skills/process/writing-plans/OPENRIG.md +0 -52
- package/daemon/specs/agents/shared/skills/process/writing-plans/SKILL.md +0 -126
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import os from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { spawnSync } from "node:child_process";
|
|
6
|
+
import crypto from "node:crypto";
|
|
7
|
+
|
|
8
|
+
const TEXT_LIMIT = 4000;
|
|
9
|
+
const BASE64_RUN = 800; // strip contiguous base64 runs at least this long (screenshots, data URIs)
|
|
10
|
+
|
|
11
|
+
function sha256(text) {
|
|
12
|
+
return crypto.createHash("sha256").update(String(text ?? "")).digest("hex").slice(0, 16);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// R3: replace binary / base64 payloads (data: URIs, long base64 runs) with a compact marker,
|
|
16
|
+
// so a single screenshot block does not blow the transcript into un-chunkable size.
|
|
17
|
+
function stripBinary(text) {
|
|
18
|
+
let s = String(text ?? "");
|
|
19
|
+
s = s.replace(/data:([\w.+-]+\/[\w.+-]+)?;base64,[A-Za-z0-9+/=\s]{200,}/g,
|
|
20
|
+
(m, mime) => `[binary omitted: ~${m.length} bytes${mime ? `, ${mime}` : ""}]`);
|
|
21
|
+
s = s.replace(new RegExp(`[A-Za-z0-9+/]{${BASE64_RUN},}={0,2}`, "g"),
|
|
22
|
+
(m) => `[base64 omitted: ~${m.length} bytes]`);
|
|
23
|
+
return s;
|
|
24
|
+
}
|
|
25
|
+
const DEFAULT_OUT = "/tmp/claude-compaction-restore";
|
|
26
|
+
|
|
27
|
+
function parseArgs(argv) {
|
|
28
|
+
const args = {
|
|
29
|
+
jsonl: null,
|
|
30
|
+
out: DEFAULT_OUT,
|
|
31
|
+
cwd: process.cwd(),
|
|
32
|
+
json: false,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
36
|
+
const arg = argv[i];
|
|
37
|
+
if (arg === "--jsonl") args.jsonl = argv[++i];
|
|
38
|
+
else if (arg === "--out") args.out = argv[++i];
|
|
39
|
+
else if (arg === "--cwd") args.cwd = argv[++i];
|
|
40
|
+
else if (arg === "--json") args.json = true;
|
|
41
|
+
else if (!arg.startsWith("-") && !args.jsonl) args.jsonl = arg;
|
|
42
|
+
else throw new Error(`unknown argument: ${arg}`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return args;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function readJsonLines(file) {
|
|
49
|
+
const raw = fs.readFileSync(file, "utf8");
|
|
50
|
+
return raw
|
|
51
|
+
.split(/\r?\n/)
|
|
52
|
+
.filter(Boolean)
|
|
53
|
+
.map((line, index) => {
|
|
54
|
+
try {
|
|
55
|
+
return JSON.parse(line);
|
|
56
|
+
} catch (error) {
|
|
57
|
+
return { type: "parse-error", line: index + 1, error: String(error), raw: line };
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function findLatestJsonl(cwd) {
|
|
63
|
+
const projectsRoot = path.join(os.homedir(), ".claude", "projects");
|
|
64
|
+
if (!fs.existsSync(projectsRoot)) return null;
|
|
65
|
+
|
|
66
|
+
const encoded = cwd ? cwd.replaceAll("/", "-") : null;
|
|
67
|
+
const candidates = [];
|
|
68
|
+
const roots = [];
|
|
69
|
+
|
|
70
|
+
if (encoded) {
|
|
71
|
+
const exact = path.join(projectsRoot, encoded);
|
|
72
|
+
if (fs.existsSync(exact)) roots.push(exact);
|
|
73
|
+
}
|
|
74
|
+
roots.push(projectsRoot);
|
|
75
|
+
|
|
76
|
+
for (const root of roots) {
|
|
77
|
+
const result = spawnSync("find", [root, "-name", "*.jsonl", "-maxdepth", root === projectsRoot ? "4" : "2"], {
|
|
78
|
+
encoding: "utf8",
|
|
79
|
+
});
|
|
80
|
+
if (result.status !== 0 && !result.stdout) continue;
|
|
81
|
+
for (const file of result.stdout.split(/\r?\n/).filter(Boolean)) {
|
|
82
|
+
try {
|
|
83
|
+
const stat = fs.statSync(file);
|
|
84
|
+
candidates.push({ file, mtimeMs: stat.mtimeMs });
|
|
85
|
+
} catch {
|
|
86
|
+
// Ignore raced/deleted transcript files.
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (candidates.length) break;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
candidates.sort((a, b) => b.mtimeMs - a.mtimeMs);
|
|
93
|
+
return candidates[0]?.file ?? null;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function stringifyContent(content) {
|
|
97
|
+
if (typeof content === "string") return content;
|
|
98
|
+
if (Array.isArray(content)) {
|
|
99
|
+
return content
|
|
100
|
+
.map((block) => {
|
|
101
|
+
if (typeof block === "string") return block;
|
|
102
|
+
if (block?.type === "text") return block.text ?? "";
|
|
103
|
+
if (block?.type === "image") return `[image omitted: ${block.source?.media_type ?? "image"}]`;
|
|
104
|
+
if (block?.type === "tool_use") return `[tool_use:${block.name}] ${JSON.stringify(block.input ?? {})}`;
|
|
105
|
+
if (block?.type === "tool_result") return `[tool_result] ${truncate(stripBinary(stringifyContent(block.content)), TEXT_LIMIT)}`;
|
|
106
|
+
return JSON.stringify(block);
|
|
107
|
+
})
|
|
108
|
+
.join("\n");
|
|
109
|
+
}
|
|
110
|
+
if (content == null) return "";
|
|
111
|
+
return JSON.stringify(content);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function truncate(text, max) {
|
|
115
|
+
const s = String(text ?? "");
|
|
116
|
+
if (s.length <= max) return s;
|
|
117
|
+
return `${s.slice(0, max)}\n[...truncated ${s.length - max} chars...]`;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function walkStrings(value, acc = []) {
|
|
121
|
+
if (typeof value === "string") acc.push(value);
|
|
122
|
+
else if (Array.isArray(value)) value.forEach((item) => walkStrings(item, acc));
|
|
123
|
+
else if (value && typeof value === "object") Object.values(value).forEach((item) => walkStrings(item, acc));
|
|
124
|
+
return acc;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function normalizeFile(candidate, cwd) {
|
|
128
|
+
let file = candidate.trim().replace(/[),.;:'"`\]\}>]+$/g, "").replace(/^[('"`<\[]+/g, "");
|
|
129
|
+
if (!file || file.includes("\n")) return null;
|
|
130
|
+
if (/\.(?:md|mdx|txt|json|jsonl|yaml|yml|toml|ts|tsx|js|jsx|mjs|cjs|py|sh|rs|go|sql|css|scss|html|xml|svg|csv|log|lock)\//i.test(file)) return null;
|
|
131
|
+
if (file.startsWith("~")) file = path.join(os.homedir(), file.slice(1));
|
|
132
|
+
let normalized = null;
|
|
133
|
+
if (file.startsWith("/")) normalized = path.normalize(file);
|
|
134
|
+
else if (file.startsWith("./") || file.startsWith("../")) normalized = path.normalize(path.resolve(cwd, file));
|
|
135
|
+
else if (/^[A-Za-z0-9_@.+-][A-Za-z0-9_@.+/\-:]*\.[A-Za-z0-9]+$/.test(file)) {
|
|
136
|
+
normalized = path.normalize(path.resolve(cwd, file));
|
|
137
|
+
} else if (/^(CLAUDE|AGENTS|README|DESIGN|CULTURE|MEMORY)\.md$/.test(file)) {
|
|
138
|
+
normalized = path.normalize(path.resolve(cwd, file));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
if (!normalized) return null;
|
|
142
|
+
try {
|
|
143
|
+
if (fs.existsSync(normalized) && fs.statSync(normalized).isDirectory()) return null;
|
|
144
|
+
} catch {
|
|
145
|
+
// Keep the candidate if stat races; the restore agent can decide.
|
|
146
|
+
}
|
|
147
|
+
return normalized;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function extractPaths(text, cwd) {
|
|
151
|
+
const paths = new Set();
|
|
152
|
+
const s = String(text ?? "");
|
|
153
|
+
const absolute = /(?:^|[\s"'(<\[])(\/(?:Users|private|tmp|var|opt|Volumes)\/[^\s"'()\]<>]+)/g;
|
|
154
|
+
const relative = /(?:^|[\s"'(<\[])((?:\.{1,2}\/)?[A-Za-z0-9_@.+-][A-Za-z0-9_@.+/\-:]*\.(?:md|mdx|txt|json|jsonl|yaml|yml|toml|ts|tsx|js|jsx|mjs|cjs|py|sh|rs|go|sql|css|scss|html|xml|svg|csv|log|lock))(?:$|[\s"')>\],.;:])/g;
|
|
155
|
+
const namedMarkdown = /(?:^|[\s"'(<\[])((?:CLAUDE|AGENTS|README|DESIGN|CULTURE|MEMORY)\.md)(?:$|[\s"')>\],.;:])/g;
|
|
156
|
+
|
|
157
|
+
for (const regex of [absolute, relative, namedMarkdown]) {
|
|
158
|
+
let match;
|
|
159
|
+
while ((match = regex.exec(s)) !== null) {
|
|
160
|
+
const normalized = normalizeFile(match[1], cwd);
|
|
161
|
+
if (normalized) paths.add(normalized);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
return [...paths];
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function createRegistry() {
|
|
168
|
+
const files = new Map();
|
|
169
|
+
let sequence = 0;
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
add(file, kind, source) {
|
|
173
|
+
if (!file) return;
|
|
174
|
+
const existing = files.get(file) ?? {
|
|
175
|
+
path: file,
|
|
176
|
+
kinds: {},
|
|
177
|
+
sources: new Set(),
|
|
178
|
+
firstSeen: sequence,
|
|
179
|
+
lastSeen: sequence,
|
|
180
|
+
};
|
|
181
|
+
existing.kinds[kind] = (existing.kinds[kind] ?? 0) + 1;
|
|
182
|
+
existing.sources.add(source);
|
|
183
|
+
existing.lastSeen = sequence;
|
|
184
|
+
files.set(file, existing);
|
|
185
|
+
},
|
|
186
|
+
tick() {
|
|
187
|
+
sequence += 1;
|
|
188
|
+
},
|
|
189
|
+
values() {
|
|
190
|
+
return [...files.values()].map((entry) => ({
|
|
191
|
+
...entry,
|
|
192
|
+
sources: [...entry.sources].slice(0, 8),
|
|
193
|
+
}));
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function toolKind(name, input) {
|
|
199
|
+
if (["Write", "Edit", "MultiEdit", "NotebookEdit"].includes(name)) return "written";
|
|
200
|
+
if (name === "Read") return "read";
|
|
201
|
+
if (["Grep", "Glob", "LS"].includes(name)) return "discovered";
|
|
202
|
+
if (name === "Bash") {
|
|
203
|
+
const command = input?.command ?? "";
|
|
204
|
+
if (/\b(apply_patch|tee|touch|mkdir|mv|cp|rm)\b|(^|[^>])>{1,2}[^>]/.test(command)) return "shell-write";
|
|
205
|
+
return "shell-mentioned";
|
|
206
|
+
}
|
|
207
|
+
return "mentioned";
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
function scoreFile(entry) {
|
|
211
|
+
const ext = path.extname(entry.path).toLowerCase();
|
|
212
|
+
let score = 0;
|
|
213
|
+
if (entry.kinds.written) score += 40;
|
|
214
|
+
if (entry.kinds["shell-write"]) score += 30;
|
|
215
|
+
if (entry.kinds["file-history"]) score += 35;
|
|
216
|
+
if (ext === ".md" || ext === ".mdx") score += 20;
|
|
217
|
+
if (entry.kinds.read) score += 10;
|
|
218
|
+
if (entry.kinds.discovered) score += 4;
|
|
219
|
+
if (/\/docs\/as-built\//.test(entry.path)) score += 25;
|
|
220
|
+
if (/(codemap|architecture|CLAUDE|AGENTS|README|DESIGN|CULTURE|session\.log|queue\.md)/i.test(entry.path)) score += 15;
|
|
221
|
+
score += Math.min(10, Object.values(entry.kinds).reduce((a, b) => a + b, 0));
|
|
222
|
+
return score;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function discoverDocs(cwd) {
|
|
226
|
+
const candidates = [
|
|
227
|
+
"CLAUDE.md",
|
|
228
|
+
"AGENTS.md",
|
|
229
|
+
"README.md",
|
|
230
|
+
"docs/as-built",
|
|
231
|
+
"docs",
|
|
232
|
+
];
|
|
233
|
+
const docs = new Set();
|
|
234
|
+
|
|
235
|
+
for (const candidate of candidates) {
|
|
236
|
+
const full = path.resolve(cwd, candidate);
|
|
237
|
+
if (!fs.existsSync(full)) continue;
|
|
238
|
+
const stat = fs.statSync(full);
|
|
239
|
+
if (stat.isFile()) docs.add(full);
|
|
240
|
+
if (stat.isDirectory()) {
|
|
241
|
+
const result = spawnSync("find", [full, "-maxdepth", candidate === "docs" ? "2" : "1", "-type", "f", "-name", "*.md"], {
|
|
242
|
+
encoding: "utf8",
|
|
243
|
+
});
|
|
244
|
+
for (const file of result.stdout.split(/\r?\n/).filter(Boolean)) {
|
|
245
|
+
if (/as-built|codemap|architecture|README|overview/i.test(file)) docs.add(path.normalize(file));
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return [...docs].sort();
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function analyze(jsonlPath, cwd) {
|
|
254
|
+
const records = readJsonLines(jsonlPath);
|
|
255
|
+
const registry = createRegistry();
|
|
256
|
+
const transcript = [];
|
|
257
|
+
const narrative = []; // R4: message-turns only (assistant/user text), no tool bodies
|
|
258
|
+
const readTargets = new Map(); // R1: tool_use_id -> file_path for Read calls
|
|
259
|
+
const cwdCounts = new Map();
|
|
260
|
+
let sessionId = null;
|
|
261
|
+
|
|
262
|
+
for (const record of records) {
|
|
263
|
+
registry.tick();
|
|
264
|
+
if (record.sessionId || record.session_id) sessionId = record.sessionId ?? record.session_id;
|
|
265
|
+
if (record.cwd) {
|
|
266
|
+
cwdCounts.set(record.cwd, (cwdCounts.get(record.cwd) ?? 0) + 1);
|
|
267
|
+
cwd = record.cwd;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (record.type === "file-history-snapshot") {
|
|
271
|
+
const backups = record.snapshot?.trackedFileBackups ?? {};
|
|
272
|
+
for (const file of Object.keys(backups)) registry.add(path.normalize(file), "file-history", "file-history-snapshot");
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const message = record.message;
|
|
276
|
+
if (!message) continue;
|
|
277
|
+
const role = message.role ?? record.type ?? "unknown";
|
|
278
|
+
const content = message.content;
|
|
279
|
+
|
|
280
|
+
if (typeof content === "string") {
|
|
281
|
+
transcript.push(`\n## ${role}\n\n${content}`);
|
|
282
|
+
narrative.push(`\n## ${role}\n\n${content}`);
|
|
283
|
+
for (const file of extractPaths(content, cwd)) registry.add(file, "mentioned", `${role}:text`);
|
|
284
|
+
continue;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (!Array.isArray(content)) continue;
|
|
288
|
+
const parts = [];
|
|
289
|
+
const narrativeParts = [];
|
|
290
|
+
for (const block of content) {
|
|
291
|
+
if (block?.type === "text") {
|
|
292
|
+
parts.push(block.text ?? "");
|
|
293
|
+
narrativeParts.push(block.text ?? "");
|
|
294
|
+
for (const file of extractPaths(block.text ?? "", cwd)) registry.add(file, "mentioned", `${role}:text`);
|
|
295
|
+
} else if (block?.type === "tool_use") {
|
|
296
|
+
const name = block.name ?? "unknown";
|
|
297
|
+
const input = block.input ?? {};
|
|
298
|
+
parts.push(`\n[tool_use:${name}]\n${JSON.stringify(input, null, 2)}`);
|
|
299
|
+
if (name === "Read" && block.id && (input.file_path || input.path)) {
|
|
300
|
+
readTargets.set(block.id, input.file_path || input.path);
|
|
301
|
+
}
|
|
302
|
+
const kind = toolKind(name, input);
|
|
303
|
+
if (input.file_path) registry.add(normalizeFile(input.file_path, cwd), kind, `tool:${name}:file_path`);
|
|
304
|
+
if (input.path) registry.add(normalizeFile(input.path, cwd), kind, `tool:${name}:path`);
|
|
305
|
+
if (input.notebook_path) registry.add(normalizeFile(input.notebook_path, cwd), kind, `tool:${name}:notebook_path`);
|
|
306
|
+
for (const text of walkStrings(input)) {
|
|
307
|
+
for (const file of extractPaths(text, cwd)) registry.add(file, kind, `tool:${name}:input`);
|
|
308
|
+
}
|
|
309
|
+
} else if (block?.type === "tool_result") {
|
|
310
|
+
const resultText = stripBinary(stringifyContent(block.content));
|
|
311
|
+
const target = block.tool_use_id && readTargets.get(block.tool_use_id);
|
|
312
|
+
if (target) {
|
|
313
|
+
// R1: a Read result reproduces a whole file — emit a pointer, not the body.
|
|
314
|
+
// The live file is current; this transcript copy is a snapshot that may be stale.
|
|
315
|
+
const lineCount = resultText.split("\n").length;
|
|
316
|
+
parts.push(`\n[tool_result: Read ${target} — ${lineCount} lines, sha256 ${sha256(resultText)} — READ THE LIVE FILE; this snapshot may be stale]`);
|
|
317
|
+
} else {
|
|
318
|
+
parts.push(`\n[tool_result]\n${truncate(resultText, TEXT_LIMIT)}`);
|
|
319
|
+
}
|
|
320
|
+
for (const file of extractPaths(resultText, cwd)) registry.add(file, "mentioned", "tool_result");
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
if (parts.length) transcript.push(`\n## ${role}\n\n${parts.join("\n")}`);
|
|
324
|
+
if (narrativeParts.some((p) => String(p).trim())) narrative.push(`\n## ${role}\n\n${narrativeParts.join("\n")}`);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
const rankedFiles = registry
|
|
328
|
+
.values()
|
|
329
|
+
.map((entry) => ({ ...entry, score: scoreFile(entry), markdown: [".md", ".mdx"].includes(path.extname(entry.path).toLowerCase()) }))
|
|
330
|
+
.sort((a, b) => b.score - a.score || a.path.localeCompare(b.path));
|
|
331
|
+
|
|
332
|
+
const cwdRanked = [...cwdCounts.entries()].sort((a, b) => b[1] - a[1]);
|
|
333
|
+
const effectiveCwd = cwdRanked[0]?.[0] ?? cwd;
|
|
334
|
+
|
|
335
|
+
const transcriptText = transcript.join("\n");
|
|
336
|
+
const narrativeText = narrative.join("\n");
|
|
337
|
+
return {
|
|
338
|
+
sessionId,
|
|
339
|
+
jsonlPath,
|
|
340
|
+
cwd: effectiveCwd,
|
|
341
|
+
records: records.length,
|
|
342
|
+
transcript: transcriptText,
|
|
343
|
+
narrative: narrativeText,
|
|
344
|
+
transcriptTokens: Math.round(transcriptText.length / 4),
|
|
345
|
+
narrativeTokens: Math.round(narrativeText.length / 4),
|
|
346
|
+
files: rankedFiles,
|
|
347
|
+
docs: discoverDocs(effectiveCwd),
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
function markdownFileList(files) {
|
|
352
|
+
const lines = [];
|
|
353
|
+
lines.push("# Touched Files");
|
|
354
|
+
lines.push("");
|
|
355
|
+
lines.push("Files are ranked for restore relevance. Markdown and written files are the first candidates to read in full.");
|
|
356
|
+
lines.push("");
|
|
357
|
+
|
|
358
|
+
const sections = [
|
|
359
|
+
["Highest-priority Markdown/state files", (f) => f.markdown && (f.kinds.written || f.kinds["shell-write"] || f.kinds["file-history"])],
|
|
360
|
+
["Other written/tracked files", (f) => !f.markdown && (f.kinds.written || f.kinds["shell-write"] || f.kinds["file-history"])],
|
|
361
|
+
["Read/discovered/mentioned files", (f) => !(f.kinds.written || f.kinds["shell-write"] || f.kinds["file-history"])],
|
|
362
|
+
];
|
|
363
|
+
|
|
364
|
+
for (const [title, predicate] of sections) {
|
|
365
|
+
const group = files.filter(predicate);
|
|
366
|
+
if (!group.length) continue;
|
|
367
|
+
lines.push(`## ${title}`);
|
|
368
|
+
lines.push("");
|
|
369
|
+
for (const file of group) {
|
|
370
|
+
const kinds = Object.entries(file.kinds).map(([kind, count]) => `${kind}:${count}`).join(", ");
|
|
371
|
+
lines.push(`- score ${file.score} — \`${file.path}\` — ${kinds}`);
|
|
372
|
+
}
|
|
373
|
+
lines.push("");
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return lines.join("\n");
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function restoreInstructions(summary, outputPaths) {
|
|
380
|
+
const lines = [];
|
|
381
|
+
lines.push("# Claude Compaction Restore Instructions");
|
|
382
|
+
lines.push("");
|
|
383
|
+
lines.push("You have just been compacted or are restoring a compacted Claude Code seat. Your mental model is compressed and unreliable.");
|
|
384
|
+
lines.push("");
|
|
385
|
+
lines.push(`- JSONL transcript: \`${summary.jsonlPath}\``);
|
|
386
|
+
lines.push(`- Reconstructed transcript: \`${outputPaths.transcript}\` (~${summary.transcriptTokens ?? "?"} tokens — do NOT read front-to-back)`);
|
|
387
|
+
lines.push(`- Narrative companion (READ THIS FIRST): \`${outputPaths.narrative}\` (~${summary.narrativeTokens ?? "?"} tokens — message turns only, no tool bodies)`);
|
|
388
|
+
lines.push(`- Touched-file triage: \`${outputPaths.touchedFiles}\``);
|
|
389
|
+
lines.push(`- Working directory inferred: \`${summary.cwd}\``);
|
|
390
|
+
lines.push("");
|
|
391
|
+
lines.push("## Read budget (the restore must leave room for the work)");
|
|
392
|
+
lines.push("");
|
|
393
|
+
lines.push(`- The full transcript is ~${summary.transcriptTokens ?? "?"} tokens. **Reading it front-to-back can consume the window the restore exists to rebuild.**`);
|
|
394
|
+
lines.push(`- Default order: read the **narrative companion first** (~${summary.narrativeTokens ?? "?"} tokens — message turns + decisions), tail-first (most recent first).`);
|
|
395
|
+
lines.push("- Drop to the full transcript only for a specific question the narrative can't answer. File bodies inside tool-results are pointers now — **read the live file, not the transcript snapshot.**");
|
|
396
|
+
lines.push("- Read to a budget with a stopping rule; report depth honestly (an honest PARTIAL beats a false completion). See the skill's *Required Read-Depth Audit*.");
|
|
397
|
+
lines.push("");
|
|
398
|
+
lines.push("## Required Sequence");
|
|
399
|
+
lines.push("");
|
|
400
|
+
lines.push("1. Read this file and `touched-files.md`.");
|
|
401
|
+
lines.push("2. Ask yourself: which files do I recognize as important to the work and project state?");
|
|
402
|
+
lines.push("3. Mark those files mentally or in a short note.");
|
|
403
|
+
lines.push("4. Read every important Markdown/state/planning file in full.");
|
|
404
|
+
lines.push("5. Read project root docs in full when present: `CLAUDE.md`, `AGENTS.md`, `README.md`.");
|
|
405
|
+
lines.push("6. Read as-built docs and codemaps in full before product work, code review, or architecture decisions.");
|
|
406
|
+
lines.push("7. State exactly: `restored from packet at <path>; resumed at step <X>`.");
|
|
407
|
+
lines.push("");
|
|
408
|
+
lines.push("## Documentation Candidates");
|
|
409
|
+
lines.push("");
|
|
410
|
+
if (summary.docs.length) {
|
|
411
|
+
for (const doc of summary.docs) lines.push(`- \`${doc}\``);
|
|
412
|
+
} else {
|
|
413
|
+
lines.push("- No root/as-built/codemap candidates were found automatically. Search manually before resuming code/review work.");
|
|
414
|
+
}
|
|
415
|
+
lines.push("");
|
|
416
|
+
lines.push("## Top File Candidates");
|
|
417
|
+
lines.push("");
|
|
418
|
+
for (const file of summary.files.slice(0, 30)) {
|
|
419
|
+
lines.push(`- \`${file.path}\` — score ${file.score}`);
|
|
420
|
+
}
|
|
421
|
+
lines.push("");
|
|
422
|
+
lines.push("Do not continue from fuzzy memory alone.");
|
|
423
|
+
return lines.join("\n");
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// A3-R3 injectable clock (slice 51-01): the packet output-dir timestamped path
|
|
427
|
+
// defaults to real wall-clock, but becomes deterministic when the shared hermetic
|
|
428
|
+
// env-var OPENRIG_TEST_CLOCK_NOW is set (an ISO instant). Empty/absent = production.
|
|
429
|
+
function nowIso() {
|
|
430
|
+
const injected = process.env.OPENRIG_TEST_CLOCK_NOW;
|
|
431
|
+
return typeof injected === "string" && injected.trim().length > 0 ? injected : new Date().toISOString();
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
function writeOutputs(summary, outRoot) {
|
|
435
|
+
const stamp = nowIso().replace(/[:.]/g, "-");
|
|
436
|
+
const base = path.join(outRoot, `${summary.sessionId ?? "unknown-session"}-${stamp}`);
|
|
437
|
+
fs.mkdirSync(base, { recursive: true });
|
|
438
|
+
|
|
439
|
+
const outputPaths = {
|
|
440
|
+
dir: base,
|
|
441
|
+
transcript: path.join(base, "transcript.txt"),
|
|
442
|
+
narrative: path.join(base, "transcript-narrative.txt"),
|
|
443
|
+
touchedFiles: path.join(base, "touched-files.md"),
|
|
444
|
+
instructions: path.join(base, "restore-instructions.md"),
|
|
445
|
+
summary: path.join(base, "restore-summary.json"),
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
fs.writeFileSync(outputPaths.transcript, summary.transcript || "(no message transcript reconstructed)\n");
|
|
449
|
+
fs.writeFileSync(outputPaths.narrative, summary.narrative || "(no narrative reconstructed)\n");
|
|
450
|
+
fs.writeFileSync(outputPaths.touchedFiles, markdownFileList(summary.files));
|
|
451
|
+
fs.writeFileSync(outputPaths.instructions, restoreInstructions(summary, outputPaths));
|
|
452
|
+
fs.writeFileSync(outputPaths.summary, JSON.stringify({ ...summary, transcript: undefined, narrative: undefined, outputPaths }, null, 2));
|
|
453
|
+
|
|
454
|
+
return outputPaths;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
function main() {
|
|
458
|
+
const args = parseArgs(process.argv.slice(2));
|
|
459
|
+
const cwd = path.resolve(args.cwd);
|
|
460
|
+
const jsonlPath = args.jsonl ? path.resolve(args.jsonl) : findLatestJsonl(cwd);
|
|
461
|
+
if (!jsonlPath) throw new Error("could not find a Claude JSONL transcript; pass one explicitly");
|
|
462
|
+
if (!fs.existsSync(jsonlPath)) throw new Error(`JSONL transcript not found: ${jsonlPath}`);
|
|
463
|
+
|
|
464
|
+
const summary = analyze(jsonlPath, cwd);
|
|
465
|
+
const outputPaths = writeOutputs(summary, path.resolve(args.out));
|
|
466
|
+
const result = {
|
|
467
|
+
ok: true,
|
|
468
|
+
jsonlPath,
|
|
469
|
+
outputDir: outputPaths.dir,
|
|
470
|
+
transcript: outputPaths.transcript,
|
|
471
|
+
narrative: outputPaths.narrative,
|
|
472
|
+
transcriptTokens: summary.transcriptTokens,
|
|
473
|
+
narrativeTokens: summary.narrativeTokens,
|
|
474
|
+
touchedFiles: outputPaths.touchedFiles,
|
|
475
|
+
instructions: outputPaths.instructions,
|
|
476
|
+
fileCount: summary.files.length,
|
|
477
|
+
topFiles: summary.files.slice(0, 12).map((file) => file.path),
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
if (args.json) console.log(JSON.stringify(result, null, 2));
|
|
481
|
+
else {
|
|
482
|
+
console.log(`Restore packet: ${result.outputDir}`);
|
|
483
|
+
console.log(`Instructions: ${result.instructions}`);
|
|
484
|
+
console.log(`Touched files: ${result.touchedFiles}`);
|
|
485
|
+
console.log(`Narrative (read first): ${result.narrative} (~${result.narrativeTokens} tokens)`);
|
|
486
|
+
console.log(`Transcript (drill-down): ${result.transcript} (~${result.transcriptTokens} tokens)`);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
try {
|
|
491
|
+
main();
|
|
492
|
+
} catch (error) {
|
|
493
|
+
console.error(`claude-compaction-restore failed: ${error.message}`);
|
|
494
|
+
process.exit(1);
|
|
495
|
+
}
|
package/daemon/context-packs/skills/claude-compaction-restore/templates/compact-instruction.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Optional. Leave blank to use Claude Code's native compaction summary behavior; OpenRig's pre-compaction preparation and post-compaction restore prompts carry the durable continuity protocol.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Read the claude-compaction-restore skill and follow its "If You Just Compacted" protocol.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# GENERATED by scripts/generate-context-packs.mjs — DO NOT EDIT.
|
|
2
2
|
# Package-time projection of a canonical skill; regenerated every build.
|
|
3
3
|
name: "agent-starters"
|
|
4
|
-
version: "0.5.
|
|
4
|
+
version: "0.5.8"
|
|
5
5
|
taxonomy: "skills"
|
|
6
6
|
purpose: "Use when creating, refreshing, packaging, inspecting, promoting, or deprecating a named per-seat starting point — Agent Starter manifest authoring, the 6-state lifecycle (captured → named → inspectable → used → promoted → deprecated), provenance honesty, and refusal rules. NOT a VM image; a managed starting point composed from agent role + startup context + optional native session source + provenance."
|
|
7
7
|
files:
|
|
@@ -102,7 +102,7 @@ culture / pod / member / operator) handles the layering.
|
|
|
102
102
|
|
|
103
103
|
## See also
|
|
104
104
|
|
|
105
|
-
- `mission-slice-sop` skill — the universal operating procedure for working a mission/slice (the canonical PROGRESS
|
|
105
|
+
- `mission-slice-sop` skill — the universal operating procedure for working a mission/slice (the canonical SPEC.md, NOTES.md, PROGRESS.md, PROOF.md, and proof/ surfaces); every agent should reach for it at startup, so this general reading contract points at it here (do NOT duplicate the SOP into seat-specific startup files).
|
|
106
106
|
- `writing-skills-for-openrig` skill — authoring discipline for skill content (what doesn't belong in startup)
|
|
107
107
|
- `forming-an-openrig-mental-model` skill — orientation for new agents
|
|
108
108
|
- `session-compaction-and-restore` skill — restore-time startup ingestion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# GENERATED by scripts/generate-context-packs.mjs — DO NOT EDIT.
|
|
2
2
|
# Package-time projection of a canonical skill; regenerated every build.
|
|
3
3
|
name: "agent-startup-and-context-ingestion"
|
|
4
|
-
version: "0.5.
|
|
4
|
+
version: "0.5.8"
|
|
5
5
|
taxonomy: "skills"
|
|
6
6
|
purpose: "Use when designing or auditing how an agent becomes useful after launch — AGENTS.md overlays, role files, skills, rig specs, workflow specs, startup checklists, refocus messages, \"rig context\" surface. Covers the 4 failure modes that make startup context fail (old rig spec misses current operating mode; current agents never told about new guidance; startup file as dumping ground; orchestrator transmits implementation without preserving product intent)."
|
|
7
7
|
files:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# GENERATED by scripts/generate-context-packs.mjs — DO NOT EDIT.
|
|
2
2
|
# Package-time projection of a canonical skill; regenerated every build.
|
|
3
3
|
name: "cross-host-rig-commands"
|
|
4
|
-
version: "0.5.
|
|
4
|
+
version: "0.5.8"
|
|
5
5
|
taxonomy: "skills"
|
|
6
6
|
purpose: "Use when issuing `rig` commands against a remote host via `--host <id>` flag (single-hop SSH to a host declared in `~/.openrig/hosts.yaml`). Covers the 4 structured failure modes (ssh-unreachable / permission-gate / remote-daemon-unreachable / remote-command-failed), the `--verify` honest pass-through (SSH success is NOT verify success), and the host-registry shape. v0 supports `rig send / capture / ps / whoami --host <id>`."
|
|
7
7
|
files:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# GENERATED by scripts/generate-context-packs.mjs — DO NOT EDIT.
|
|
2
2
|
# Package-time projection of a canonical skill; regenerated every build.
|
|
3
3
|
name: "human-in-the-loop"
|
|
4
|
-
version: "0.5.
|
|
4
|
+
version: "0.5.8"
|
|
5
5
|
taxonomy: "skills"
|
|
6
6
|
purpose: "Use when classifying a slice closeout (auto-continue / human gate / park), routing a real decision to a human, or designing a human queue/dashboard surface. Treats humans as durable network participants with attention surfaces, queues, and decision records — escalation lands as a durable attention item, not a chat message. Approval is NOT required for every clean closeout; the default RSI conveyor continues unless an explicit human gate is reached."
|
|
7
7
|
files:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# GENERATED by scripts/generate-context-packs.mjs — DO NOT EDIT.
|
|
2
2
|
# Package-time projection of a canonical skill; regenerated every build.
|
|
3
3
|
name: "messaging-the-human"
|
|
4
|
-
version: "0.5.
|
|
4
|
+
version: "0.5.8"
|
|
5
5
|
taxonomy: "skills"
|
|
6
6
|
purpose: "Use when a human decision, access grant, external action, or escalation must survive the operator's absence, or when an orchestrator or PM has a judgment-worthy update for the operator."
|
|
7
7
|
files:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# GENERATED by scripts/generate-context-packs.mjs — DO NOT EDIT.
|
|
2
2
|
# Package-time projection of a canonical skill; regenerated every build.
|
|
3
3
|
name: "openrig-architect"
|
|
4
|
-
version: "0.5.
|
|
4
|
+
version: "0.5.8"
|
|
5
5
|
taxonomy: "skills"
|
|
6
6
|
purpose: "Use when designing multi-agent topologies that run ON OpenRig — authoring RigSpec and AgentSpec files for new rigs, creating agent startup content (guidance / skills / culture), or diagnosing why a launched rig's agents aren't behaving as intended. NOT for changing OpenRig itself (use openrig-builder); NOT for ordinary CLI operation of an existing rig (use openrig-user). Covers the full authoring lifecycle from user intent to validated, launchable rig."
|
|
7
7
|
files:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# GENERATED by scripts/generate-context-packs.mjs — DO NOT EDIT.
|
|
2
2
|
# Package-time projection of a canonical skill; regenerated every build.
|
|
3
3
|
name: "openrig-cmux"
|
|
4
|
-
version: "0.5.
|
|
4
|
+
version: "0.5.8"
|
|
5
5
|
taxonomy: "skills"
|
|
6
6
|
purpose: "Use when opening OpenRig fleet terminals into cmux — turning a rig, pod, mission, slice, or saved view into live agent tiles via `rig terminal --provider cmux`, or driving cmux on an agent's request. Same OpenRig view semantics as openrig-herdr (the verbs, honest-partial/degrade, read-only cross-rig, scroll/copy, same-size-only duplicates); cmux is the **best-effort** provider (herdr is the default and the proof-gated one). Prefer openrig-herdr unless cmux is specifically wanted."
|
|
7
7
|
files:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# GENERATED by scripts/generate-context-packs.mjs — DO NOT EDIT.
|
|
2
2
|
# Package-time projection of a canonical skill; regenerated every build.
|
|
3
3
|
name: "openrig-herdr"
|
|
4
|
-
version: "0.5.
|
|
4
|
+
version: "0.5.8"
|
|
5
5
|
taxonomy: "skills"
|
|
6
6
|
purpose: "Use when opening OpenRig fleet terminals as a herdr wall — turning a rig, pod, mission, slice, or saved view into live interactive agent tiles via `rig terminal`, watching another rig read-only, or driving herdr on an agent's request (\"open all my rigs + a mission as views\"). Covers the `rig terminal open|views|status` verbs, the honest-partial/degrade reading of the result, the read-only-by-construction rail for cross-rig views, scroll/copy out of the box, and the same-size-only duplicate-pane "
|
|
7
7
|
files:
|
|
@@ -54,6 +54,7 @@ These are auto-delivered to every rig; their name+description are already in you
|
|
|
54
54
|
- **applying-a-permission-policy** — a rig or seat has a permission policy attached, or you're setting one up: translate it into the live harness configuration.
|
|
55
55
|
- **claude-compaction-restore** — you just compacted (Claude). Restore from durable evidence before resuming real work.
|
|
56
56
|
- **delegating-work** — deciding who should do a task: you, a spawned subagent, or a durable peer seat that already holds the context.
|
|
57
|
+
- **loading-addressable-markdown** — a task names Markdown as `path#h2-slug` or `path#h2-slug/h3-slug` outside the context-pack library.
|
|
57
58
|
- **session-compaction-and-restore** — preparing for, or recovering from, compaction (any runtime). The write- and read-side protocol.
|
|
58
59
|
- **queue-handoff** — you're passing durable work to another seat or ending your turn. The queue is the work ledger, not chat.
|
|
59
60
|
- **refocusing** — a long-running seat may have lost the product outcome, crossed a major boundary, or compacted and needs a fresh path-based trace.
|
|
@@ -105,10 +106,6 @@ General engineering skills OpenRig ships as vendored copies. Open when the task
|
|
|
105
106
|
- **test-driven-development** — implementing a feature or bugfix: write the failing test first.
|
|
106
107
|
- **verification-before-completion** — about to claim done / passing / fixed: run the check and read the output first.
|
|
107
108
|
- **systematic-debugging** — debugging: find the root cause before the fix.
|
|
108
|
-
- **writing-plans** — writing an implementation plan.
|
|
109
|
-
- **executing-plans** — working through a written plan.
|
|
110
|
-
- **brainstorming** — divergent ideation before converging.
|
|
111
|
-
- **using-superpowers** — discovering and using the vendored "superpowers" skill set.
|
|
112
109
|
- **agent-browser** — driving a browser (screenshot / screencast) from an agent.
|
|
113
110
|
- **frontend-design** — designing frontend / UI.
|
|
114
111
|
- **dogfood** — web-QA / dogfooding a shipped UI.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# GENERATED by scripts/generate-context-packs.mjs — DO NOT EDIT.
|
|
2
2
|
# Package-time projection of a canonical skill; regenerated every build.
|
|
3
3
|
name: "openrig-skills"
|
|
4
|
-
version: "0.5.
|
|
4
|
+
version: "0.5.8"
|
|
5
5
|
taxonomy: "skills"
|
|
6
6
|
purpose: "Use when you're operating OpenRig and need the right skill or context for fleet recovery, seat handover, new-seat orientation, a watchdog wake, cross-host reach to an agent on another machine, rig packaging, an OpenRig upgrade, systematic debugging, queue triage, or implementation planning; also use when you don't know what applies or nothing is projected on cold boot."
|
|
7
7
|
files:
|