aiwcli 0.15.5 → 0.17.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/README.md +108 -1124
- package/bin/run.js +0 -4
- package/dist/capabilities/branch/adapters.d.ts +2 -0
- package/dist/capabilities/branch/adapters.js +21 -0
- package/dist/capabilities/branch/contracts.d.ts +57 -0
- package/dist/capabilities/branch/contracts.js +1 -0
- package/dist/capabilities/branch/control-plane.d.ts +2 -0
- package/dist/capabilities/branch/control-plane.js +343 -0
- package/dist/capabilities/branch/runtime-core.d.ts +5 -0
- package/dist/capabilities/branch/runtime-core.js +36 -0
- package/dist/capabilities/installation/control-plane/clean-command.d.ts +41 -0
- package/dist/capabilities/installation/control-plane/clean-command.js +196 -0
- package/dist/capabilities/installation/control-plane/clear-command.d.ts +162 -0
- package/dist/capabilities/installation/control-plane/clear-command.js +1249 -0
- package/dist/capabilities/installation/control-plane/init-command.d.ts +81 -0
- package/dist/capabilities/installation/control-plane/init-command.js +449 -0
- package/dist/capabilities/launch/contracts.d.ts +86 -0
- package/dist/capabilities/launch/contracts.js +1 -0
- package/dist/capabilities/launch/control-plane/execute-launch.d.ts +2 -0
- package/dist/capabilities/launch/control-plane/execute-launch.js +261 -0
- package/dist/capabilities/launch/runtime-core/launch-decisions.d.ts +82 -0
- package/dist/capabilities/launch/runtime-core/launch-decisions.js +202 -0
- package/dist/capabilities/launch/runtime-core/launch-options.d.ts +14 -0
- package/dist/capabilities/launch/runtime-core/launch-options.js +69 -0
- package/dist/cli/base-command.d.ts +18 -0
- package/dist/cli/base-command.js +55 -0
- package/dist/commands/branch.d.ts +1 -21
- package/dist/commands/branch.js +25 -417
- package/dist/commands/clean.d.ts +1 -41
- package/dist/commands/clean.js +1 -196
- package/dist/commands/clear.d.ts +1 -161
- package/dist/commands/clear.js +1 -1121
- package/dist/commands/init/index.d.ts +1 -98
- package/dist/commands/init/index.js +4 -478
- package/dist/commands/launch.d.ts +32 -12
- package/dist/commands/launch.js +107 -166
- package/dist/lib/claude-settings-types.d.ts +31 -19
- package/dist/lib/config.js +1 -2
- package/dist/lib/context/context-formatter.d.ts +74 -0
- package/dist/lib/context/context-formatter.js +493 -0
- package/dist/lib/context/context-selector.d.ts +42 -0
- package/dist/lib/context/context-selector.js +451 -0
- package/dist/lib/context/context-store.d.ts +100 -0
- package/dist/lib/context/context-store.js +644 -0
- package/dist/lib/context/plan-manager.d.ts +54 -0
- package/dist/lib/context/plan-manager.js +282 -0
- package/dist/lib/context/task-tracker.d.ts +44 -0
- package/dist/lib/context/task-tracker.js +146 -0
- package/dist/lib/core-ide-base.d.ts +4 -0
- package/dist/lib/core-ide-base.js +77 -0
- package/dist/lib/core-installer.d.ts +5 -0
- package/dist/lib/core-installer.js +33 -0
- package/dist/lib/debug.d.ts +0 -10
- package/dist/lib/debug.js +0 -10
- package/dist/lib/env-sanitizer.d.ts +25 -0
- package/dist/lib/env-sanitizer.js +46 -0
- package/dist/lib/errors.d.ts +0 -13
- package/dist/lib/errors.js +0 -15
- package/dist/lib/git-exclude-manager.d.ts +2 -2
- package/dist/lib/git-exclude-manager.js +3 -3
- package/dist/lib/hooks/context-monitor-logic.d.ts +6 -0
- package/dist/lib/hooks/context-monitor-logic.js +25 -0
- package/dist/lib/hooks/hook-utils.d.ts +143 -0
- package/dist/lib/hooks/hook-utils.js +620 -0
- package/dist/lib/hooks/prompt-binding-logic.d.ts +7 -0
- package/dist/lib/hooks/prompt-binding-logic.js +50 -0
- package/dist/lib/hooks/session-end-logic.d.ts +5 -0
- package/dist/lib/hooks/session-end-logic.js +51 -0
- package/dist/lib/hooks-merger.js +25 -19
- package/dist/lib/ide-path-resolver.d.ts +19 -7
- package/dist/lib/ide-path-resolver.js +25 -9
- package/dist/lib/install-state.d.ts +34 -0
- package/dist/lib/install-state.js +154 -0
- package/dist/lib/json-io.d.ts +12 -0
- package/dist/lib/json-io.js +30 -0
- package/dist/lib/lsp-patch.d.ts +12 -0
- package/dist/lib/lsp-patch.js +156 -0
- package/dist/lib/multiplexer.d.ts +65 -0
- package/dist/lib/multiplexer.js +38 -0
- package/dist/lib/multiplexers/psmux.d.ts +55 -0
- package/dist/lib/multiplexers/psmux.js +324 -0
- package/dist/lib/multiplexers/tmux.d.ts +36 -0
- package/dist/lib/multiplexers/tmux.js +221 -0
- package/dist/lib/multiplexers/wezterm.d.ts +38 -0
- package/dist/lib/multiplexers/wezterm.js +225 -0
- package/dist/lib/mux-utils.d.ts +6 -0
- package/dist/lib/mux-utils.js +36 -0
- package/dist/lib/paths.d.ts +2 -2
- package/dist/lib/paths.js +2 -2
- package/dist/lib/platform-commands.d.ts +27 -0
- package/dist/lib/platform-commands.js +49 -0
- package/dist/lib/prompt-file-manager.d.ts +23 -0
- package/dist/lib/prompt-file-manager.js +41 -0
- package/dist/lib/runtime/agent-launcher.d.ts +67 -0
- package/dist/lib/runtime/agent-launcher.js +262 -0
- package/dist/lib/runtime/aiw-cli.d.ts +39 -0
- package/dist/lib/runtime/aiw-cli.js +76 -0
- package/dist/lib/runtime/atomic-write.d.ts +19 -0
- package/dist/lib/runtime/atomic-write.js +121 -0
- package/dist/lib/runtime/cli-args.d.ts +58 -0
- package/dist/lib/runtime/cli-args.js +200 -0
- package/dist/lib/runtime/constants.d.ts +56 -0
- package/dist/lib/runtime/constants.js +230 -0
- package/dist/lib/runtime/executable-policy.d.ts +16 -0
- package/dist/lib/runtime/executable-policy.js +57 -0
- package/dist/lib/runtime/git-state.d.ts +9 -0
- package/dist/lib/runtime/git-state.js +59 -0
- package/dist/lib/runtime/inference.d.ts +37 -0
- package/dist/lib/runtime/inference.js +251 -0
- package/dist/lib/runtime/lint-dispatch.d.ts +40 -0
- package/dist/lib/runtime/lint-dispatch.js +285 -0
- package/dist/lib/runtime/logger.d.ts +66 -0
- package/dist/lib/runtime/logger.js +201 -0
- package/dist/lib/runtime/models.d.ts +20 -0
- package/dist/lib/runtime/models.js +20 -0
- package/dist/lib/runtime/platform-adapter.d.ts +7 -0
- package/dist/lib/runtime/platform-adapter.js +21 -0
- package/dist/lib/runtime/preflight.d.ts +24 -0
- package/dist/lib/runtime/preflight.js +65 -0
- package/dist/lib/runtime/sentinel-ipc.d.ts +14 -0
- package/dist/lib/runtime/sentinel-ipc.js +67 -0
- package/dist/lib/runtime/state-io.d.ts +31 -0
- package/dist/lib/runtime/state-io.js +179 -0
- package/dist/lib/runtime/stop-words.d.ts +20 -0
- package/dist/lib/runtime/stop-words.js +150 -0
- package/dist/lib/runtime/subprocess-utils.d.ts +29 -0
- package/dist/lib/runtime/subprocess-utils.js +96 -0
- package/dist/lib/runtime/tmux-preflight.d.ts +13 -0
- package/dist/lib/runtime/tmux-preflight.js +78 -0
- package/dist/lib/runtime/utils.d.ts +62 -0
- package/dist/lib/runtime/utils.js +192 -0
- package/dist/lib/schemas.d.ts +250 -0
- package/dist/lib/schemas.js +216 -0
- package/dist/lib/sentinel-manager.d.ts +32 -0
- package/dist/lib/sentinel-manager.js +62 -0
- package/dist/lib/sentinel-wrapper.d.ts +10 -0
- package/dist/lib/sentinel-wrapper.js +29 -0
- package/dist/lib/settings-hierarchy.js +3 -20
- package/dist/lib/shell-adapters/bash-adapter.d.ts +18 -0
- package/dist/lib/shell-adapters/bash-adapter.js +69 -0
- package/dist/lib/shell-adapters/index.d.ts +5 -0
- package/dist/lib/shell-adapters/index.js +7 -0
- package/dist/lib/shell-adapters/powershell-adapter.d.ts +18 -0
- package/dist/lib/shell-adapters/powershell-adapter.js +62 -0
- package/dist/lib/shell-adapters/shell-adapter.d.ts +45 -0
- package/dist/lib/shell-adapters/shell-adapter.js +5 -0
- package/dist/lib/shell-quoting.d.ts +5 -0
- package/dist/lib/shell-quoting.js +17 -0
- package/dist/lib/spawn-errors.d.ts +9 -0
- package/dist/lib/spawn-errors.js +29 -0
- package/dist/lib/spawn.js +5 -11
- package/dist/lib/spinner.d.ts +0 -5
- package/dist/lib/spinner.js +0 -16
- package/dist/lib/template-installer.d.ts +14 -5
- package/dist/lib/template-installer.js +40 -38
- package/dist/lib/template-resolver.d.ts +6 -7
- package/dist/lib/template-resolver.js +26 -21
- package/dist/lib/template-settings-reconstructor.d.ts +7 -2
- package/dist/lib/template-settings-reconstructor.js +76 -45
- package/dist/lib/terminal-strategy.d.ts +12 -0
- package/dist/lib/terminal-strategy.js +55 -0
- package/dist/lib/terminal.d.ts +34 -4
- package/dist/lib/terminal.js +192 -119
- package/dist/lib/tmux-pane-placement.d.ts +17 -0
- package/dist/lib/tmux-pane-placement.js +58 -0
- package/dist/lib/tmux-primitives.d.ts +3 -0
- package/dist/lib/tmux-primitives.js +11 -0
- package/dist/lib/tmux-session.d.ts +32 -0
- package/dist/lib/tmux-session.js +87 -0
- package/dist/lib/tty-detection.js +1 -1
- package/dist/lib/types.d.ts +168 -0
- package/dist/lib/types.js +6 -0
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/lib/windsurf-hooks-hierarchy.js +6 -23
- package/dist/platform/launch.d.ts +11 -0
- package/dist/platform/launch.js +11 -0
- package/dist/templates/CLAUDE.md +30 -40
- package/dist/templates/cc-native/.claude/settings.json +26 -36
- package/dist/templates/cc-native/CC-NATIVE-README.md +1 -1
- package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +20 -12
- package/dist/templates/cc-native/_cc-native/cc-native.config.json +2 -6
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +39 -59
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +9 -11
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_subagent.ts +2 -2
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +4 -5
- package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +4 -4
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +2 -27
- package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +7 -7
- package/dist/templates/cc-native/_cc-native/lib-ts/.mocharc.json +9 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/aggregate-agents.test.ts +118 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/artifacts.test.ts +234 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cc-native-state.test.ts +170 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cli-output-parser.test.ts +73 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/config.test.ts +64 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/constants.test.ts +40 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/debug.test.ts +42 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/exports.test.ts +58 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/helpers.ts +107 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/add-plan-context.hook.test.ts +97 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-questions.hook.test.ts +81 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-review.hook.test.ts +71 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/json-parser.test.ts +99 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator-agent.test.ts +288 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator.test.ts +48 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/reviewers.test.ts +32 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/state.test.ts +124 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/verdict.test.ts +93 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/agent-selection.ts +163 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +6 -14
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/format.ts +597 -599
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/index.ts +26 -26
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/tracker.ts +106 -107
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/write.ts +118 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +21 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +17 -16
- package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +132 -10
- package/dist/templates/cc-native/_cc-native/lib-ts/config.ts +1 -1
- package/dist/templates/cc-native/_cc-native/lib-ts/constants.ts +6 -6
- package/dist/templates/cc-native/_cc-native/lib-ts/corroboration.ts +119 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +2 -3
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/graduation.ts +132 -132
- package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +88 -86
- package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +5 -6
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/orchestrator.ts +70 -70
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/output-builder.ts +130 -121
- package/dist/templates/cc-native/_cc-native/lib-ts/package-lock.json +1679 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/package.json +24 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +5 -5
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +1 -6
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/plan-questions.ts +101 -101
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/review-pipeline.ts +511 -543
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/__tests__/agent-providers.test.ts +262 -0
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/agent.ts +71 -85
- package/dist/templates/{_shared/lib-ts/agent-exec → cc-native/_cc-native/lib-ts/reviewers/base}/base-agent.ts +138 -150
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/index.ts +12 -12
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/claude-agent.ts +66 -57
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/codex-agent.ts +185 -200
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/gemini-agent.ts +39 -40
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/orchestrator-claude-agent.ts +196 -225
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/schemas.ts +201 -201
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/types.ts +21 -23
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/hyde.test.ts +365 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/ollama-client.test.ts +223 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +12 -16
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +3 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +31 -31
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +7 -8
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +7 -9
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +16 -19
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +37 -41
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +33 -43
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +20 -20
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +9 -10
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +3 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +50 -126
- package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +20 -22
- package/dist/templates/cc-native/_cc-native/lib-ts/tsconfig.json +2 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +14 -89
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/verdict.ts +72 -72
- package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +38 -1
- package/dist/templates/cc-native/_cc-native/plan-review/lib/__tests__/agent-selection.test.ts +345 -0
- package/dist/templates/cc-native/_cc-native/plan-review/lib/__tests__/preflight.test.ts +344 -0
- package/dist/templates/cc-native/_cc-native/plan-review/lib/agent-selection.ts +38 -16
- package/dist/templates/cc-native/_cc-native/plan-review/lib/preflight.ts +56 -26
- package/dist/templates/cc-native/_cc-native/scripts/council_debate.ts +242 -0
- package/dist/templates/cc-native/_cc-native/scripts/council_debate_simple.ts +294 -0
- package/dist/templates/cc-native/_cc-native/{plan-review/workflows → workflows}/specdev.md +9 -9
- package/dist/templates/core/.claude/skills/codex/SKILL.md +25 -0
- package/dist/templates/core/.claude/skills/devin/SKILL.md +25 -0
- package/dist/templates/core/.claude/skills/handoff/SKILL.md +11 -0
- package/dist/templates/core/.claude/skills/handoff-resume/SKILL.md +11 -0
- package/dist/templates/core/.claude/skills/meta-plan/SKILL.md +13 -0
- package/dist/templates/core/.codex/skills/codex/SKILL.md +13 -0
- package/dist/templates/core/.codex/skills/devin/SKILL.md +19 -0
- package/dist/templates/core/.codex/skills/handoff/SKILL.md +11 -0
- package/dist/templates/core/.codex/skills/handoff-resume/SKILL.md +11 -0
- package/dist/templates/core/.codex/skills/meta-plan/SKILL.md +13 -0
- package/dist/templates/core/.devin/AGENTS.md +5 -0
- package/dist/templates/core/.devin/config.json +12 -0
- package/dist/templates/core/.devin/skills/codex/SKILL.md +19 -0
- package/dist/templates/core/.devin/skills/devin/SKILL.md +13 -0
- package/dist/templates/core/.devin/skills/handoff/SKILL.md +11 -0
- package/dist/templates/core/.devin/skills/handoff-resume/SKILL.md +11 -0
- package/dist/templates/core/.devin/skills/meta-plan/SKILL.md +13 -0
- package/dist/templates/core/.windsurf/workflows/handoff-resume.md +9 -0
- package/dist/templates/{_shared → core}/.windsurf/workflows/handoff.md +1 -1
- package/dist/templates/{_shared → core}/.windsurf/workflows/meta-plan.md +1 -1
- package/dist/templates/core/hooks-ts/_utils/git-state.ts +2 -0
- package/dist/templates/{_shared → core}/hooks-ts/archive_plan.ts +15 -44
- package/dist/templates/core/hooks-ts/codex_explorer.ts +160 -0
- package/dist/templates/{_shared → core}/hooks-ts/context_monitor.ts +23 -55
- package/dist/templates/{_shared → core}/hooks-ts/file-suggestion.ts +5 -22
- package/dist/templates/{_shared → core}/hooks-ts/lint_after_edit.ts +7 -9
- package/dist/templates/core/hooks-ts/pre_compact.ts +36 -0
- package/dist/templates/{_shared → core}/hooks-ts/session_end.ts +38 -78
- package/dist/templates/{_shared → core}/hooks-ts/session_start.ts +5 -5
- package/dist/templates/core/hooks-ts/task_create_capture.ts +32 -0
- package/dist/templates/{_shared → core}/hooks-ts/task_update_capture.ts +9 -24
- package/dist/templates/core/hooks-ts/user_prompt_submit.ts +46 -0
- package/dist/templates/{_shared → core}/lib-ts/CLAUDE.md +27 -16
- package/dist/templates/{_shared → core}/lib-ts/context/CLAUDE.md +9 -6
- package/dist/templates/{_shared → core}/lib-ts/context/context-formatter.ts +16 -21
- package/dist/templates/{_shared → core}/lib-ts/context/context-selector.ts +8 -6
- package/dist/templates/{_shared → core}/lib-ts/context/context-store.ts +59 -20
- package/dist/templates/{_shared → core}/lib-ts/context/plan-manager.ts +19 -15
- package/dist/templates/{_shared → core}/lib-ts/context/task-tracker.ts +3 -3
- package/dist/templates/core/lib-ts/hooks/context-monitor-logic.ts +32 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/hooks}/hook-utils.ts +179 -41
- package/dist/templates/core/lib-ts/hooks/prompt-binding-logic.ts +80 -0
- package/dist/templates/core/lib-ts/hooks/session-end-logic.ts +82 -0
- package/dist/templates/core/lib-ts/package.json +19 -0
- package/dist/templates/core/lib-ts/runtime/agent-launcher.ts +369 -0
- package/dist/templates/core/lib-ts/runtime/aiw-cli.ts +108 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/atomic-write.ts +12 -7
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/cli-args.ts +24 -8
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/constants.ts +326 -324
- package/dist/templates/core/lib-ts/runtime/executable-policy.ts +89 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/git-state.ts +6 -4
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/inference.ts +60 -23
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/lint-dispatch.ts +25 -23
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/logger.ts +32 -29
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/models.ts +9 -2
- package/dist/templates/core/lib-ts/runtime/platform-adapter.ts +33 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/preflight.ts +4 -3
- package/dist/templates/core/lib-ts/runtime/sentinel-ipc.ts +91 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/state-io.ts +20 -11
- package/dist/templates/core/lib-ts/runtime/stop-words.ts +185 -0
- package/dist/templates/core/lib-ts/runtime/subprocess-utils.ts +147 -0
- package/dist/templates/core/lib-ts/runtime/tmux-preflight.ts +93 -0
- package/dist/templates/{_shared/lib-ts/base → core/lib-ts/runtime}/utils.ts +34 -4
- package/dist/templates/core/lib-ts/schemas.ts +233 -0
- package/dist/templates/{_shared → core}/lib-ts/templates/formatters.ts +7 -5
- package/dist/templates/{_shared → core}/lib-ts/templates/plan-context.ts +2 -1
- package/dist/templates/{_shared → core}/lib-ts/tsconfig.json +3 -1
- package/dist/templates/{_shared → core}/lib-ts/types.ts +78 -77
- package/dist/templates/core/scripts/resolve-run.ts +93 -0
- package/dist/templates/{_shared → core}/scripts/resolve_context.ts +3 -3
- package/dist/templates/{_shared → core}/scripts/status_line.ts +26 -21
- package/dist/templates/core/skills/codex/CLAUDE.md +83 -0
- package/dist/templates/{_shared → core}/skills/codex/SKILL.md +27 -18
- package/dist/templates/{_shared → core}/skills/codex/lib/codex-watcher.ts +79 -113
- package/dist/templates/{_shared → core}/skills/codex/scripts/launch-codex.ts +134 -148
- package/dist/templates/{_shared → core}/skills/codex/scripts/watch-codex.ts +6 -4
- package/dist/templates/core/skills/devin/CLAUDE.md +122 -0
- package/dist/templates/core/skills/devin/SKILL.md +73 -0
- package/dist/templates/core/skills/devin/lib/devin-watcher.ts +300 -0
- package/dist/templates/core/skills/devin/scripts/launch-devin.ts +258 -0
- package/dist/templates/{_shared → core}/skills/handoff-system/CLAUDE.md +436 -433
- package/dist/templates/{_shared → core}/skills/handoff-system/lib/document-generator.ts +9 -7
- package/dist/templates/{_shared → core}/skills/handoff-system/lib/handoff-reader.ts +6 -4
- package/dist/templates/{_shared → core}/skills/handoff-system/scripts/resume_handoff.ts +10 -8
- package/dist/templates/{_shared → core}/skills/handoff-system/scripts/save_handoff.ts +12 -10
- package/dist/templates/{_shared → core}/skills/handoff-system/workflows/handoff-resume.md +2 -2
- package/dist/templates/{_shared → core}/skills/handoff-system/workflows/handoff.md +6 -5
- package/dist/templates/{_shared → core}/skills/meta-plan/CLAUDE.md +2 -1
- package/dist/templates/{_shared → core}/skills/meta-plan/workflows/meta-plan.md +8 -7
- package/oclif.manifest.json +89 -13
- package/package.json +13 -12
- package/dist/lib/base-command.d.ts +0 -114
- package/dist/lib/base-command.js +0 -153
- package/dist/lib/env-compat.d.ts +0 -18
- package/dist/lib/env-compat.js +0 -23
- package/dist/lib/stdin.d.ts +0 -48
- package/dist/lib/stdin.js +0 -60
- package/dist/templates/_shared/.claude/settings.json +0 -120
- package/dist/templates/_shared/.claude/skills/codex/SKILL.md +0 -35
- package/dist/templates/_shared/.claude/skills/handoff/SKILL.md +0 -13
- package/dist/templates/_shared/.claude/skills/handoff-resume/SKILL.md +0 -13
- package/dist/templates/_shared/.claude/skills/meta-plan/SKILL.md +0 -43
- package/dist/templates/_shared/.codex/workflows/codex.md +0 -11
- package/dist/templates/_shared/.codex/workflows/handoff.md +0 -226
- package/dist/templates/_shared/.codex/workflows/meta-plan.md +0 -347
- package/dist/templates/_shared/hooks-ts/_utils/git-state.ts +0 -2
- package/dist/templates/_shared/hooks-ts/pre_compact.ts +0 -49
- package/dist/templates/_shared/hooks-ts/task_create_capture.ts +0 -48
- package/dist/templates/_shared/hooks-ts/user_prompt_submit.ts +0 -93
- package/dist/templates/_shared/lib-ts/agent-exec/backends/headless.ts +0 -33
- package/dist/templates/_shared/lib-ts/agent-exec/backends/index.ts +0 -6
- package/dist/templates/_shared/lib-ts/agent-exec/backends/tmux.ts +0 -119
- package/dist/templates/_shared/lib-ts/agent-exec/execution-backend.ts +0 -50
- package/dist/templates/_shared/lib-ts/agent-exec/index.ts +0 -6
- package/dist/templates/_shared/lib-ts/agent-exec/structured-output.ts +0 -166
- package/dist/templates/_shared/lib-ts/base/launchers/tmux-launcher.ts +0 -173
- package/dist/templates/_shared/lib-ts/base/launchers/window-launcher.ts +0 -93
- package/dist/templates/_shared/lib-ts/base/launchers/wt-launcher.ts +0 -64
- package/dist/templates/_shared/lib-ts/base/pane-launcher.ts +0 -55
- package/dist/templates/_shared/lib-ts/base/sentinel-ipc.ts +0 -87
- package/dist/templates/_shared/lib-ts/base/stop-words.ts +0 -184
- package/dist/templates/_shared/lib-ts/base/subprocess-utils.ts +0 -249
- package/dist/templates/_shared/lib-ts/base/tmux-driver.ts +0 -341
- package/dist/templates/_shared/lib-ts/base/tmux-pane-placement.ts +0 -78
- package/dist/templates/_shared/lib-ts/package.json +0 -20
- package/dist/templates/_shared/scripts/resolve-run.ts +0 -62
- package/dist/templates/_shared/skills/codex/CLAUDE.md +0 -70
- package/dist/templates/cc-native/_cc-native/CLAUDE.md +0 -73
- package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +0 -64
- package/dist/templates/cc-native/_cc-native/lib-ts/CLAUDE.md +0 -70
- package/dist/templates/cc-native/_cc-native/plan-review/CODING-STANDARDS-CHECKLIST.md +0 -75
- package/dist/templates/cc-native/_cc-native/plan-review/agents/CLAUDE.md +0 -143
- package/dist/templates/cc-native/_cc-native/plan-review/agents/PLAN-ORCHESTRATOR.md +0 -213
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-questions/PLAN-QUESTIONER.md +0 -70
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-EVOLUTION.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-PATTERNS.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-STRUCTURE.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ASSUMPTION-TRACER.md +0 -56
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CLARITY-AUDITOR.md +0 -53
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-FEASIBILITY.md +0 -66
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-GAPS.md +0 -70
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-ORDERING.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CONSTRAINT-VALIDATOR.md +0 -72
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-ADR-VALIDATOR.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-SCALE-MATCHER.md +0 -64
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DEVILS-ADVOCATE.md +0 -56
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DOCUMENTATION-PHILOSOPHY.md +0 -86
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HANDOFF-READINESS.md +0 -59
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HIDDEN-COMPLEXITY.md +0 -58
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/INCREMENTAL-DELIVERY.md +0 -66
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-DEPENDENCY.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-FMEA.md +0 -66
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-PREMORTEM.md +0 -71
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-REVERSIBILITY.md +0 -74
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SCOPE-BOUNDARY.md +0 -77
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SIMPLICITY-GUARDIAN.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SKEPTIC.md +0 -68
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-BEHAVIOR-AUDITOR.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-CHARACTERIZATION.md +0 -71
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-FIRST-VALIDATOR.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-PYRAMID-ANALYZER.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-COSTS.md +0 -67
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-STAKEHOLDERS.md +0 -65
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-COVERAGE.md +0 -74
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-STRENGTH.md +0 -69
- package/dist/templates/cc-native/_cc-native/plan-review/lib/corroboration.ts +0 -172
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/base/base-agent.ts +0 -7
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
# Handoff Workflow
|
|
2
|
-
|
|
3
|
-
Generate a handoff document summarizing the current session's work, decisions, and pending items. Optionally update a plan document to track completed vs remaining tasks.
|
|
4
|
-
|
|
5
|
-
## Triggers
|
|
6
|
-
|
|
7
|
-
- `/handoff` command
|
|
8
|
-
- `/handoff path/to/PLAN.md` - with plan document integration
|
|
9
|
-
- Phrases like "write a handoff", "create a session summary", "document what we did", "end session with notes"
|
|
10
|
-
|
|
11
|
-
## Arguments
|
|
12
|
-
|
|
13
|
-
- `$ARGUMENTS` - Optional path to a plan document. If provided, the handoff will:
|
|
14
|
-
1. Mark completed items in the plan with `[x]`
|
|
15
|
-
2. Add notes about partial progress
|
|
16
|
-
3. Append a "Session Progress" section to the plan
|
|
17
|
-
|
|
18
|
-
## Process
|
|
19
|
-
|
|
20
|
-
### Step 1: Get Context ID
|
|
21
|
-
|
|
22
|
-
Extract the `context_id` from the system reminder injected by the context enforcer hook.
|
|
23
|
-
|
|
24
|
-
Look for the pattern in the system reminder:
|
|
25
|
-
```
|
|
26
|
-
Active Context: {context_id}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
If no active context is found, inform the user and stop - handoffs require an active context.
|
|
30
|
-
|
|
31
|
-
### Step 2: Gather Information
|
|
32
|
-
|
|
33
|
-
1. Review conversation history for:
|
|
34
|
-
- Completed tasks and implementations
|
|
35
|
-
- Key decisions and their rationale
|
|
36
|
-
- Failed approaches (to avoid repeating)
|
|
37
|
-
- External context (deadlines, stakeholder requirements)
|
|
38
|
-
|
|
39
|
-
2. Check git status if available:
|
|
40
|
-
```bash
|
|
41
|
-
git status --short
|
|
42
|
-
git diff --stat
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
3. Look for TODOs/FIXMEs mentioned in session
|
|
46
|
-
|
|
47
|
-
4. **If plan document provided**: Read the plan and identify:
|
|
48
|
-
- Tasks that are now completed
|
|
49
|
-
- Tasks that are partially done
|
|
50
|
-
- Tasks that were attempted but blocked
|
|
51
|
-
- New tasks discovered during implementation
|
|
52
|
-
|
|
53
|
-
### Step 3: Generate Document
|
|
54
|
-
|
|
55
|
-
Use this template. The `<!-- SECTION: name -->` markers are required for the save script to parse sections into sharded files.
|
|
56
|
-
|
|
57
|
-
```markdown
|
|
58
|
-
---
|
|
59
|
-
title: Session Handoff
|
|
60
|
-
date: {ISO timestamp}
|
|
61
|
-
session_id: {conversation ID if available}
|
|
62
|
-
project: {project name from package.json, Cargo.toml, or directory name}
|
|
63
|
-
context_id: {context_id from Step 1}
|
|
64
|
-
plan_document: {path to plan if provided, or "none"}
|
|
65
|
-
---
|
|
66
|
-
|
|
67
|
-
# Session Handoff — {Date}
|
|
68
|
-
|
|
69
|
-
<!-- SECTION: summary -->
|
|
70
|
-
## Summary
|
|
71
|
-
{2-3 sentences: what's different now vs. session start}
|
|
72
|
-
|
|
73
|
-
<!-- SECTION: completed -->
|
|
74
|
-
## Work Completed
|
|
75
|
-
{Grouped by category if multiple areas. Specific file:function references.}
|
|
76
|
-
|
|
77
|
-
<!-- SECTION: dead-ends -->
|
|
78
|
-
## Dead Ends — Do Not Retry
|
|
79
|
-
|
|
80
|
-
These approaches were attempted and failed. Do not retry without addressing the root cause.
|
|
81
|
-
|
|
82
|
-
| Approach | Why It Failed | Time Spent | Alternative |
|
|
83
|
-
|----------|---------------|------------|-------------|
|
|
84
|
-
| {What was attempted} | {Specific reason} | {Rough estimate} | {What to try instead} |
|
|
85
|
-
|
|
86
|
-
<!-- SECTION: decisions -->
|
|
87
|
-
## Key Decisions
|
|
88
|
-
{Technical choices with rationale. Format: **Decision**: Rationale. Trade-off: X.}
|
|
89
|
-
|
|
90
|
-
<!-- SECTION: pending -->
|
|
91
|
-
## Pending Issues
|
|
92
|
-
- [ ] {Issue} — {severity: HIGH/MED/LOW} {optional workaround note}
|
|
93
|
-
|
|
94
|
-
<!-- SECTION: next-steps -->
|
|
95
|
-
## Next Steps
|
|
96
|
-
1. {Actionable item with file:line reference if applicable}
|
|
97
|
-
|
|
98
|
-
<!-- SECTION: files -->
|
|
99
|
-
## Files Modified
|
|
100
|
-
{Significant changes only. Skip formatting-only edits.}
|
|
101
|
-
|
|
102
|
-
<!-- SECTION: context -->
|
|
103
|
-
## Context for Future Sessions
|
|
104
|
-
{Non-obvious context: env quirks, stakeholder requirements}
|
|
105
|
-
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
### Step 4: Update Plan Document (if provided)
|
|
109
|
-
|
|
110
|
-
If a plan document path was provided in `$ARGUMENTS`:
|
|
111
|
-
|
|
112
|
-
1. **Read the plan document**
|
|
113
|
-
2. **Identify completed items**:
|
|
114
|
-
- Find checkboxes `- [ ]` that match completed work
|
|
115
|
-
- Change them to `- [x]`
|
|
116
|
-
3. **Add progress notes** to items that are partially complete:
|
|
117
|
-
- Append `(partial: {brief status})` to the line
|
|
118
|
-
4. **Append Session Progress section** at the bottom:
|
|
119
|
-
|
|
120
|
-
```markdown
|
|
121
|
-
|
|
122
|
-
---
|
|
123
|
-
|
|
124
|
-
## Session Progress Log
|
|
125
|
-
|
|
126
|
-
### {Date} — Session {session_id or timestamp}
|
|
127
|
-
|
|
128
|
-
**Completed this session:**
|
|
129
|
-
- [x] {Task from plan that was completed}
|
|
130
|
-
- [x] {Another completed task}
|
|
131
|
-
|
|
132
|
-
**Partially completed:**
|
|
133
|
-
- {Task} — {current state, what remains}
|
|
134
|
-
|
|
135
|
-
**Blocked/Deferred:**
|
|
136
|
-
- {Task} — {reason, what's needed}
|
|
137
|
-
|
|
138
|
-
**New items discovered:**
|
|
139
|
-
- [ ] {New task not in original plan}
|
|
140
|
-
- [ ] {Another new task}
|
|
141
|
-
|
|
142
|
-
---
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
5. **If no plan document was provided**:
|
|
146
|
-
- Skip plan creation - the handoff document serves as the session record
|
|
147
|
-
|
|
148
|
-
### Step 5: Save and Update Status
|
|
149
|
-
|
|
150
|
-
Instead of writing the file directly, pipe your handoff content to the save script:
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
bun .aiwcli/_shared/skills/handoff-system/scripts/save_handoff.ts "{context_id}" <<'EOF'
|
|
154
|
-
{Your complete handoff markdown content from Step 3}
|
|
155
|
-
EOF
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
This script:
|
|
159
|
-
1. Creates a folder at `_output/contexts/{context_id}/handoffs/{YYYY-MM-DD-HHMM}/`
|
|
160
|
-
2. Parses sections and writes sharded files (index.md, completed-work.md, dead-ends.md, etc.)
|
|
161
|
-
3. Copies the current plan (if any) to plan.md
|
|
162
|
-
4. Records the event in the context's event log (informational only)
|
|
163
|
-
|
|
164
|
-
Use the handoff folder for context in the next session.
|
|
165
|
-
|
|
166
|
-
## Dead Ends Section Guidelines
|
|
167
|
-
|
|
168
|
-
This section is critical for preventing context rot across sessions. Be specific:
|
|
169
|
-
|
|
170
|
-
**Bad (too vague):**
|
|
171
|
-
> - Tried using library X, didn't work
|
|
172
|
-
|
|
173
|
-
**Good (actionable):**
|
|
174
|
-
> ### Fixing the race condition in SessionStore
|
|
175
|
-
> | Approach Tried | Why It Failed |
|
|
176
|
-
> |----------------|---------------|
|
|
177
|
-
> | `async-mutex` package | Deadlock when nested calls to `getSession()` |
|
|
178
|
-
> | Redis WATCH/MULTI | Our Redis 6.x cluster doesn't support WATCH in cluster mode |
|
|
179
|
-
> | In-memory lock Map | Works single-node but breaks in horizontal scaling |
|
|
180
|
-
>
|
|
181
|
-
> **What to try instead**: Upgrade to Redis 7.x which supports WATCH in cluster mode, or use Redlock algorithm
|
|
182
|
-
|
|
183
|
-
**Capture these dead ends:**
|
|
184
|
-
- Packages/libraries that had incompatibilities
|
|
185
|
-
- Approaches that caused new bugs or regressions
|
|
186
|
-
- Solutions that worked locally but failed in CI/staging/prod
|
|
187
|
-
- Configurations that conflicted with existing setup
|
|
188
|
-
- Rabbit holes that consumed significant time without progress
|
|
189
|
-
|
|
190
|
-
## Post-Generation Output
|
|
191
|
-
|
|
192
|
-
After creating file, output:
|
|
193
|
-
|
|
194
|
-
```
|
|
195
|
-
✓ Created handoff folder: _output/contexts/{context_id}/handoffs/{YYYY-MM-DD-HHMM}/
|
|
196
|
-
- index.md (entry point with navigation)
|
|
197
|
-
- completed-work.md, dead-ends.md, decisions.md, pending.md, context.md
|
|
198
|
-
- plan.md (copy of current plan, if any)
|
|
199
|
-
|
|
200
|
-
To continue next session:
|
|
201
|
-
The index.md will be automatically suggested when you start a new session.
|
|
202
|
-
Read dead-ends.md first to avoid repeating failed approaches.
|
|
203
|
-
|
|
204
|
-
⚠️ {N} dead ends documented — avoid re-attempting these approaches
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
If plan was updated:
|
|
208
|
-
```
|
|
209
|
-
✓ Updated plan document: {path}
|
|
210
|
-
- {N} items marked complete
|
|
211
|
-
- {N} items partially complete
|
|
212
|
-
- {N} new items added
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
## Success Criteria
|
|
216
|
-
|
|
217
|
-
- [ ] Handoff folder created at `handoffs/{YYYY-MM-DD-HHMM}/`
|
|
218
|
-
- [ ] index.md contains summary and navigation table
|
|
219
|
-
- [ ] All section files created (completed-work.md, dead-ends.md, etc.)
|
|
220
|
-
- [ ] Dead ends use structured table format for quick scanning
|
|
221
|
-
- [ ] plan.md copied from context if plan exists
|
|
222
|
-
- [ ] Next steps are actionable with file references
|
|
223
|
-
- [ ] Git status included in index.md
|
|
224
|
-
- [ ] If plan provided: checkboxes updated to reflect completion status
|
|
225
|
-
- [ ] If plan provided: Session Progress Log appended
|
|
226
|
-
- [ ] Context state updated to indicate handoff pending
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
# MetaPlan Workflow
|
|
2
|
-
|
|
3
|
-
> **Trigger:** "meta-plan", "chain thinking", "dissect problem", "comprehensive plan", "help me figure out the right approach"
|
|
4
|
-
|
|
5
|
-
## Reference Material
|
|
6
|
-
|
|
7
|
-
- `../CLAUDE.md` — MetaPlan system spec: purpose, design decisions, constraints
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
A workflow for complex problems where choosing the right approach is harder than implementing it. Chains thinking categories together to produce a comprehensive, reviewable plan before any implementation begins.
|
|
12
|
-
|
|
13
|
-
## When to Use
|
|
14
|
-
|
|
15
|
-
- Problems with high ambiguity or large solution spaces
|
|
16
|
-
- Multiple valid approaches where the trade-offs are unclear
|
|
17
|
-
- Unfamiliar domains requiring structured exploration before commitment
|
|
18
|
-
- Multi-stakeholder problems needing multiple perspectives
|
|
19
|
-
- Any situation where "version 1" quality matters and rework is expensive
|
|
20
|
-
|
|
21
|
-
## When NOT to Use
|
|
22
|
-
|
|
23
|
-
- The solution is already known — just implement it
|
|
24
|
-
- Simple, well-scoped tasks with obvious approaches
|
|
25
|
-
- Trivial fixes, typos, or configuration changes
|
|
26
|
-
|
|
27
|
-
---
|
|
28
|
-
|
|
29
|
-
## Section 1 — Intent Preservation (First-Principles Decomposition)
|
|
30
|
-
|
|
31
|
-
Decompose the user's prompt into 5 categories. **Preserve all information** from the original prompt — no summarizing, no condensing, no abbreviating. Quote verbatim where possible.
|
|
32
|
-
|
|
33
|
-
### The 5 Decomposition Categories
|
|
34
|
-
|
|
35
|
-
1. **Explicit wants** — what they directly asked for, quoted verbatim where possible
|
|
36
|
-
2. **Implied wants** — what they expect but didn't state (inferred from context, domain norms, prior work)
|
|
37
|
-
3. **Explicit constraints** — stated limitations, requirements, boundaries, deadlines
|
|
38
|
-
4. **Implied constraints** — assumed limitations from context, domain norms, technical environment, prior decisions
|
|
39
|
-
5. **Anti-wants** — what they explicitly or implicitly don't want (stated rejections, implied aversions, things to avoid)
|
|
40
|
-
|
|
41
|
-
### Information Loss Check
|
|
42
|
-
|
|
43
|
-
After completing the decomposition, **re-read the original prompt in full** and explicitly list any information not captured in the 5 categories above. This prevents silent information loss.
|
|
44
|
-
|
|
45
|
-
Output one of:
|
|
46
|
-
- A numbered list of missed information items (then incorporate them into the appropriate category)
|
|
47
|
-
- "None — all information captured" (only if genuinely everything is accounted for)
|
|
48
|
-
|
|
49
|
-
### Problem Classification
|
|
50
|
-
|
|
51
|
-
Classify the problem along these dimensions to guide which thinking categories to apply:
|
|
52
|
-
|
|
53
|
-
| Dimension | Assessment |
|
|
54
|
-
|-----------|-----------|
|
|
55
|
-
| **Ambiguity level** | How many valid interpretations exist? (Low: 1-2, Medium: 3-5, High: 5+) |
|
|
56
|
-
| **Solution space size** | How many viable approaches exist? (Small: 1-2, Medium: 3-5, Large: 5+) |
|
|
57
|
-
| **Domain familiarity** | How well-understood is the problem domain? (Familiar / Partially familiar / Unfamiliar) |
|
|
58
|
-
| **Stakeholder count** | How many perspectives must be considered? (Single / Few / Many) |
|
|
59
|
-
|
|
60
|
-
---
|
|
61
|
-
|
|
62
|
-
## Section 2 — Problem Classification Decision Tree
|
|
63
|
-
|
|
64
|
-
Based on the characteristics from Section 1, select which thinking categories to apply and in what order. **Not all categories are required for every problem** — the decision tree gates execution, not just ordering.
|
|
65
|
-
|
|
66
|
-
| Problem Profile | Categories to Apply | Rationale |
|
|
67
|
-
|----------------|-------------------|-----------|
|
|
68
|
-
| High ambiguity, any domain | 1 → 2 → 3 → 7 (Decomposition → Divergent → Convergent → Integration) | Must explore broadly before narrowing |
|
|
69
|
-
| Large solution space, familiar domain | 1 → 2 → 4 → 5 → 7 (Decomposition → Divergent → Adversarial → Trade-off → Integration) | Need to stress-test candidates |
|
|
70
|
-
| Unfamiliar domain, any ambiguity | 1 → 6 → 2 → 3 → 7 (Decomposition → Expert Synthesis → Divergent → Convergent → Integration) | Research before ideation |
|
|
71
|
-
| Multi-stakeholder, moderate ambiguity | 1 → 6 → 5 → 4 → 7 (Decomposition → Expert Synthesis → Trade-off → Adversarial → Integration) | Gather perspectives, evaluate trade-offs |
|
|
72
|
-
| Low ambiguity, small solution space | 1 → 4 → 7 (Decomposition → Adversarial → Integration) | Quick path: decompose, stress-test, synthesize |
|
|
73
|
-
| Multiple valid approaches, familiar domain | 1 → 2 → 5 → 4 → 7 (Decomposition → Divergent → Trade-off → Adversarial → Integration) | Compare, evaluate, stress-test |
|
|
74
|
-
|
|
75
|
-
Numbers reference the 7 categories in Section 3.
|
|
76
|
-
|
|
77
|
-
**If no profile matches exactly:** Select the closest match, or combine elements. When in doubt, use the full sequence: 1 → 2 → 3 → 4 → 5 → 6 → 7.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## Section 3 — The 7 Thinking Categories
|
|
82
|
-
|
|
83
|
-
Each category has concrete instructions to execute directly. External skills discovered at runtime (see Section 4) can enhance any category but are never required.
|
|
84
|
-
|
|
85
|
-
### Category 1: Decomposition
|
|
86
|
-
|
|
87
|
-
Break the complex problem into atomic sub-problems that can be addressed independently.
|
|
88
|
-
|
|
89
|
-
**Instructions:**
|
|
90
|
-
- List every distinct sub-problem, constraint, and dependency
|
|
91
|
-
- Identify which sub-problems are independent (parallelizable) vs. sequential (dependent)
|
|
92
|
-
- For each sub-problem, state what "solved" looks like in one sentence
|
|
93
|
-
- Map dependencies: which sub-problems must be solved before others can start
|
|
94
|
-
|
|
95
|
-
**Output:** Numbered list of sub-problems with dependency relationships noted.
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
### Category 2: Divergent Ideation
|
|
100
|
-
|
|
101
|
-
Generate multiple distinct solution candidates — prioritize breadth over depth.
|
|
102
|
-
|
|
103
|
-
**Instructions:**
|
|
104
|
-
- For each sub-problem (or the whole problem if atomic), brainstorm 3-5 fundamentally different approaches
|
|
105
|
-
- Each approach must differ in architecture, not just parameters (e.g., "use a queue" vs "use polling" vs "use webhooks" — not "poll every 5s" vs "poll every 10s")
|
|
106
|
-
- Name each approach with a descriptive 3-5 word label
|
|
107
|
-
- For each, list 1-2 key strengths and 1-2 key weaknesses in brief
|
|
108
|
-
|
|
109
|
-
**Output:** Table of approaches per sub-problem, each with a label, strengths, and weaknesses.
|
|
110
|
-
|
|
111
|
-
---
|
|
112
|
-
|
|
113
|
-
### Category 3: Convergent Analysis
|
|
114
|
-
|
|
115
|
-
Narrow from many candidates to 1-3 finalists using structured evaluation.
|
|
116
|
-
|
|
117
|
-
**Instructions:**
|
|
118
|
-
- Define 3-5 evaluation criteria relevant to this problem (e.g., complexity, performance, maintainability, risk, time-to-implement)
|
|
119
|
-
- Score each approach against each criterion (High / Medium / Low)
|
|
120
|
-
- Identify deal-breakers: any approach that fails a critical criterion is eliminated with stated reason
|
|
121
|
-
- Rank surviving approaches
|
|
122
|
-
|
|
123
|
-
**Output:** Evaluation matrix with scores, eliminations noted, and shortlist of 1-3 surviving approaches.
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
### Category 4: Adversarial Challenge
|
|
128
|
-
|
|
129
|
-
Stress-test the leading approach(es) by actively trying to break them.
|
|
130
|
-
|
|
131
|
-
**Instructions:**
|
|
132
|
-
- Answer each question for the leading approach:
|
|
133
|
-
- "What is the strongest argument against this approach?"
|
|
134
|
-
- "Under what conditions does this approach fail catastrophically?"
|
|
135
|
-
- "What is the most likely way this approach produces a subtly wrong result?"
|
|
136
|
-
- "If I had to argue for a completely different approach, what would I say?"
|
|
137
|
-
- For each identified weakness, either:
|
|
138
|
-
- Propose a concrete mitigation, or
|
|
139
|
-
- Acknowledge the risk explicitly with conditions under which it becomes critical
|
|
140
|
-
|
|
141
|
-
**Output:** List of challenges with mitigations or acknowledged risks.
|
|
142
|
-
|
|
143
|
-
---
|
|
144
|
-
|
|
145
|
-
### Category 5: Trade-off Evaluation
|
|
146
|
-
|
|
147
|
-
Compare surviving approaches on key dimensions with explicit trade-off acknowledgment.
|
|
148
|
-
|
|
149
|
-
**Instructions:**
|
|
150
|
-
- For each pair of finalist approaches, state what you gain and what you lose by choosing one over the other
|
|
151
|
-
- Identify irreversible decisions (hard to change later) vs. reversible ones (can switch cheaply)
|
|
152
|
-
- State the conditions under which you would switch from the recommended approach to an alternative
|
|
153
|
-
- Flag any "one-way door" decisions that deserve extra scrutiny
|
|
154
|
-
|
|
155
|
-
**Output:** Trade-off matrix with gain/lose analysis and switching conditions.
|
|
156
|
-
|
|
157
|
-
---
|
|
158
|
-
|
|
159
|
-
### Category 6: Expert Synthesis
|
|
160
|
-
|
|
161
|
-
Gather domain-specific knowledge relevant to the problem.
|
|
162
|
-
|
|
163
|
-
**Instructions:**
|
|
164
|
-
- What established patterns, best practices, or prior art exist for this type of problem?
|
|
165
|
-
- What domain-specific constraints or conventions apply that a non-expert might miss?
|
|
166
|
-
- What are the known failure modes or anti-patterns in this domain?
|
|
167
|
-
- What would a domain expert check first?
|
|
168
|
-
|
|
169
|
-
*Note: This category operates on available knowledge. If external research tools or skills are available in the environment, use them to augment this category.*
|
|
170
|
-
|
|
171
|
-
**Output:** Domain knowledge summary with explicit relevance to the current problem.
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
### Category 7: Integration
|
|
176
|
-
|
|
177
|
-
Combine all thinking outputs into a coherent, actionable plan.
|
|
178
|
-
|
|
179
|
-
**Instructions:**
|
|
180
|
-
- State the recommended approach with rationale referencing evidence from prior categories
|
|
181
|
-
- List trade-offs explicitly acknowledged (from Category 5)
|
|
182
|
-
- List risks explicitly accepted with mitigations (from Category 4)
|
|
183
|
-
- Apply domain knowledge as validation (from Category 6, if used)
|
|
184
|
-
- Define concrete next steps with enough detail to begin execution immediately
|
|
185
|
-
|
|
186
|
-
**Output:** Structured plan document containing:
|
|
187
|
-
- Problem decomposition results
|
|
188
|
-
- Approaches considered with trade-offs
|
|
189
|
-
- Recommended approach with rationale
|
|
190
|
-
- Risk assessment with mitigations
|
|
191
|
-
- Domain context applied (if Category 6 was used)
|
|
192
|
-
- Actionable next steps
|
|
193
|
-
- Execution Manifest (from Section 4)
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
## Section 4 — Runtime Skill Discovery (Two-Pass)
|
|
198
|
-
|
|
199
|
-
Before executing the thinking chain, scan for ALL available skills and commands in the current environment. Skills serve two distinct roles in MetaPlan — they can enhance the *thinking* process and/or become steps in the *execution* plan.
|
|
200
|
-
|
|
201
|
-
### Discovery Protocol
|
|
202
|
-
|
|
203
|
-
**Pass 1 — Enumerate:** Scan all available skills, commands, and workflows in the current environment (skill registries, help commands, workflow directories). For each, read its description or summary.
|
|
204
|
-
|
|
205
|
-
**Pass 2 — Classify:** Place each discovered skill into one or both categories:
|
|
206
|
-
|
|
207
|
-
**Thinking Skills** — enhance one of the 7 thinking categories during the MetaPlan process itself:
|
|
208
|
-
- Decomposition-related skills → Category 1
|
|
209
|
-
- Ideation/creativity skills → Category 2
|
|
210
|
-
- Analysis/evaluation skills → Category 3
|
|
211
|
-
- Adversarial/red-team skills → Category 4
|
|
212
|
-
- Comparison/trade-off skills → Category 5
|
|
213
|
-
- Research/domain-knowledge skills → Category 6
|
|
214
|
-
- Synthesis/integration skills → Category 7
|
|
215
|
-
|
|
216
|
-
**Auxiliary Skills** — relevant to *executing* the recommended solution, not to thinking about it:
|
|
217
|
-
- Domain-specific tools (coding standards, linting, formatting, testing frameworks)
|
|
218
|
-
- Content processing (PDF extraction, image generation, data transformation)
|
|
219
|
-
- Research and information gathering (web search, content analysis)
|
|
220
|
-
- Communication and output (presentation, documentation, knowledge management)
|
|
221
|
-
- Automation and infrastructure (browser automation, deployment, CI/CD)
|
|
222
|
-
- Any skill that the person executing the plan would benefit from knowing about
|
|
223
|
-
|
|
224
|
-
A single skill can appear in both lists — e.g., a research skill might enhance Category 6 (Expert Synthesis) during thinking AND be a standalone step in the execution plan.
|
|
225
|
-
|
|
226
|
-
### If Zero Skills Are Discovered
|
|
227
|
-
|
|
228
|
-
Proceed with inline instructions only. This is the **normal path**, not a degraded path. The inline instructions in Section 3 are complete and self-contained, and the plan output uses generic step descriptions instead of skill-specific invocations.
|
|
229
|
-
|
|
230
|
-
### Skill Inventory (Required Output)
|
|
231
|
-
|
|
232
|
-
After discovery, output the classified inventory:
|
|
233
|
-
|
|
234
|
-
```
|
|
235
|
-
## Skill Inventory
|
|
236
|
-
|
|
237
|
-
### Thinking Skills (enhance MetaPlan categories)
|
|
238
|
-
| Skill | Maps To | Role |
|
|
239
|
-
|-------|---------|------|
|
|
240
|
-
| [name] | Category N | Enhances/replaces inline instructions |
|
|
241
|
-
|
|
242
|
-
### Auxiliary Skills (available for execution plan)
|
|
243
|
-
| Skill | Domain | Potential Use |
|
|
244
|
-
|-------|--------|---------------|
|
|
245
|
-
| [name] | [domain] | [how it helps execute the solution] |
|
|
246
|
-
|
|
247
|
-
### Unclassified
|
|
248
|
-
| Skill | Reason |
|
|
249
|
-
|-------|--------|
|
|
250
|
-
| [name] | Not relevant to this problem |
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
---
|
|
254
|
-
|
|
255
|
-
## Section 5 — Chain Execution
|
|
256
|
-
|
|
257
|
-
Execute the thinking categories selected by the decision tree (Section 2), in the specified order.
|
|
258
|
-
|
|
259
|
-
**Rules:**
|
|
260
|
-
- Feed each category's output forward as context for subsequent categories
|
|
261
|
-
- Accumulate all outputs in a running document
|
|
262
|
-
- If a category's output reveals new information that changes earlier conclusions, note the update explicitly (e.g., "Category 4 revealed X, which changes the Category 2 assessment of approach Y")
|
|
263
|
-
- Do not skip a selected category — if the decision tree selected it, execute it
|
|
264
|
-
|
|
265
|
-
---
|
|
266
|
-
|
|
267
|
-
## Section 6 — Plan Synthesis
|
|
268
|
-
|
|
269
|
-
The Integration category (Category 7) produces the final plan. This is the primary deliverable of MetaPlan — a **sequential, step-by-step execution plan** that a new session can follow mechanically.
|
|
270
|
-
|
|
271
|
-
The plan captures in plan mode or the project's context/notes system automatically. No special output file handling is needed.
|
|
272
|
-
|
|
273
|
-
### Part A — Analysis Summary
|
|
274
|
-
|
|
275
|
-
Summarize the thinking work that informed the plan:
|
|
276
|
-
|
|
277
|
-
1. **Problem decomposition** — sub-problems identified and dependency-mapped (Category 1)
|
|
278
|
-
2. **Solution landscape** — approaches considered with strengths and weaknesses (Category 2)
|
|
279
|
-
3. **Evaluation** — how approaches were narrowed, what was eliminated and why (Category 3, if used)
|
|
280
|
-
4. **Risk assessment** — stress-test results with mitigations or accepted risks (Category 4)
|
|
281
|
-
5. **Trade-off analysis** — what is gained and lost with the recommended approach (Category 5, if used)
|
|
282
|
-
6. **Domain context** — relevant patterns, practices, and failure modes applied (Category 6, if used)
|
|
283
|
-
7. **Recommended approach** — clear statement with rationale referencing evidence above
|
|
284
|
-
|
|
285
|
-
### Part B — Sequential Execution Plan (Skill Chain)
|
|
286
|
-
|
|
287
|
-
The core deliverable. A numbered sequence of steps that interleaves thinking categories and auxiliary skills into a single executable chain. Each step specifies exactly what to do, so a new session can follow it without additional context.
|
|
288
|
-
|
|
289
|
-
**Step format:**
|
|
290
|
-
|
|
291
|
-
```
|
|
292
|
-
### Step N: [Action description]
|
|
293
|
-
- **Invoke:** [Skill name, thinking category, or "manual" for inline work]
|
|
294
|
-
- **Input:** [What to feed this step — output from a prior step, user context, or specific files]
|
|
295
|
-
- **Expected output:** [What this step produces — be specific enough to verify completion]
|
|
296
|
-
- **Feeds into:** Step M [or "Final output"]
|
|
297
|
-
```
|
|
298
|
-
|
|
299
|
-
**Branching format** (when a step's output determines the next path):
|
|
300
|
-
|
|
301
|
-
```
|
|
302
|
-
### Step N: [Decision point description]
|
|
303
|
-
- **Invoke:** [Skill or category]
|
|
304
|
-
- **Input:** [What to evaluate]
|
|
305
|
-
- **Branch:**
|
|
306
|
-
- IF [condition A] → proceed to Step M
|
|
307
|
-
- IF [condition B] → proceed to Step P
|
|
308
|
-
- ELSE → proceed to Step Q
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
**Overlay format** (when a thinking category and auxiliary skill run together):
|
|
312
|
-
|
|
313
|
-
```
|
|
314
|
-
### Step N: [Combined action description]
|
|
315
|
-
- **Invoke:** [Thinking category] + [Auxiliary skill]
|
|
316
|
-
- **Role of thinking category:** [What the category contributes — e.g., adversarial pressure]
|
|
317
|
-
- **Role of auxiliary skill:** [What the skill contributes — e.g., domain standards to test against]
|
|
318
|
-
- **Input:** [Combined input context]
|
|
319
|
-
- **Expected output:** [Combined output]
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
**Rules for building the chain:**
|
|
323
|
-
- Every step must have a clear input and output — no dangling steps
|
|
324
|
-
- Thinking categories from Section 3 and auxiliary skills from Section 4 can freely interleave
|
|
325
|
-
- A single step can overlay a thinking category with one or more auxiliary skills when they naturally combine
|
|
326
|
-
- Branching logic uses IF/ELSE based on concrete, observable conditions from the prior step's output
|
|
327
|
-
- The chain must be followable by a session with zero prior context — include enough detail in each step
|
|
328
|
-
- If no auxiliary skills were discovered, the chain uses thinking categories and manual inline steps only
|
|
329
|
-
|
|
330
|
-
### Part C — Skill Inventory
|
|
331
|
-
|
|
332
|
-
Include the full Skill Inventory from Section 4 so the executing session knows what tools are available.
|
|
333
|
-
|
|
334
|
-
### Part D — Execution Manifest
|
|
335
|
-
|
|
336
|
-
After completing the thinking chain, output a summary showing what ran and how:
|
|
337
|
-
|
|
338
|
-
```
|
|
339
|
-
## Execution Manifest
|
|
340
|
-
| Step | Type | Skill/Category Used | Method |
|
|
341
|
-
|------|------|---------------------|--------|
|
|
342
|
-
| 1 | Thinking | Category 1: Decomposition | Inline |
|
|
343
|
-
| 2 | Auxiliary | [discovered skill name] | Skill invocation |
|
|
344
|
-
| 3 | Thinking + Auxiliary | Category 4 + [skill name] | Overlay |
|
|
345
|
-
| 4 | Branch | — | IF/ELSE on Step 3 output |
|
|
346
|
-
| ... | ... | ... | ... |
|
|
347
|
-
```
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* PreCompact hook: Save state.json snapshot before context compaction.
|
|
4
|
-
* Captures git state and session metadata for recovery.
|
|
5
|
-
*/
|
|
6
|
-
import { getProjectRoot } from "../lib-ts/base/constants.js";
|
|
7
|
-
import { getGitState } from "../lib-ts/base/git-state.js";
|
|
8
|
-
import {
|
|
9
|
-
loadHookInput, logDebug, logError, logInfo, runHook,
|
|
10
|
-
} from "../lib-ts/base/hook-utils.js";
|
|
11
|
-
import { nowIso } from "../lib-ts/base/utils.js";
|
|
12
|
-
import { getContextBySessionId, saveState } from "../lib-ts/context/context-store.js";
|
|
13
|
-
|
|
14
|
-
function main(): void {
|
|
15
|
-
const payload = loadHookInput();
|
|
16
|
-
if (!payload) return;
|
|
17
|
-
|
|
18
|
-
const sessionId = payload.session_id;
|
|
19
|
-
if (!sessionId) {
|
|
20
|
-
logDebug("pre_compact", "No session_id, skipping");
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const projectRoot = getProjectRoot(payload.cwd);
|
|
25
|
-
const state = getContextBySessionId(sessionId, projectRoot);
|
|
26
|
-
if (!state) {
|
|
27
|
-
logDebug("pre_compact", `No context bound to session ${sessionId}`);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const gitState = getGitState(projectRoot);
|
|
32
|
-
|
|
33
|
-
state.last_session = {
|
|
34
|
-
...state.last_session,
|
|
35
|
-
session_id: sessionId,
|
|
36
|
-
saved_at: nowIso(),
|
|
37
|
-
save_reason: "pre_compact",
|
|
38
|
-
git_state: gitState,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const [ok, err] = saveState(state.id, state, projectRoot);
|
|
42
|
-
if (ok) {
|
|
43
|
-
logInfo("pre_compact", `Saved pre-compact snapshot for ${state.id}`);
|
|
44
|
-
} else {
|
|
45
|
-
logError("pre_compact", `Failed to save state: ${err}`);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
runHook(main, "pre_compact");
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* PostToolUse:TaskCreate hook: Persist Claude's TaskCreate calls to state.json.
|
|
4
|
-
*/
|
|
5
|
-
import { getProjectRoot } from "../lib-ts/base/constants.js";
|
|
6
|
-
import {
|
|
7
|
-
checkSkipPersistence, getToolInput, loadHookInput, logDebug,
|
|
8
|
-
logError, logInfo, logWarn, runHook, validateHookEvent,
|
|
9
|
-
} from "../lib-ts/base/hook-utils.js";
|
|
10
|
-
import { getContextBySessionId } from "../lib-ts/context/context-store.js";
|
|
11
|
-
import { addTask } from "../lib-ts/context/task-tracker.js";
|
|
12
|
-
|
|
13
|
-
function main(): void {
|
|
14
|
-
const payload = loadHookInput();
|
|
15
|
-
if (!payload) return;
|
|
16
|
-
if (!validateHookEvent(payload, "PostToolUse", "TaskCreate")) return;
|
|
17
|
-
|
|
18
|
-
const toolInput = getToolInput(payload);
|
|
19
|
-
if (!toolInput) return;
|
|
20
|
-
if (checkSkipPersistence(payload, "task_create_capture")) return;
|
|
21
|
-
|
|
22
|
-
const projectRoot = getProjectRoot(payload.cwd);
|
|
23
|
-
const sessionId = payload.session_id ?? "unknown";
|
|
24
|
-
|
|
25
|
-
const state = getContextBySessionId(sessionId, projectRoot);
|
|
26
|
-
if (!state) {
|
|
27
|
-
logDebug("task_create_capture", `No context for session ${sessionId}`);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const subject = toolInput.subject as string | undefined;
|
|
32
|
-
if (!subject) {
|
|
33
|
-
logWarn("task_create_capture", "TaskCreate missing subject field");
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const description = (toolInput.description as string) ?? "";
|
|
38
|
-
const activeForm = (toolInput.activeForm as string) ?? "";
|
|
39
|
-
|
|
40
|
-
const task = addTask(state.id, subject, description, activeForm, sessionId, projectRoot);
|
|
41
|
-
if (task) {
|
|
42
|
-
logInfo("task_create_capture", `Persisted task ${task.id}: ${subject}`);
|
|
43
|
-
} else {
|
|
44
|
-
logError("task_create_capture", `Failed to persist task: ${subject}`);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
runHook(main, "task_create_capture");
|