@cortex-agent/server 2026.5.19-1
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/defaults/.claude/settings.json +13 -0
- package/defaults/CORTEX.md +15 -0
- package/defaults/config/budget.json +4 -0
- package/defaults/config/session-hooks.json +7 -0
- package/defaults/config/thread-templates.json +528 -0
- package/defaults/context/CORTEX.md +40 -0
- package/defaults/context/decisions/DR-0012.md +54 -0
- package/defaults/context/ideas/CORTEX.md +10 -0
- package/defaults/context/projects/CORTEX.md +25 -0
- package/defaults/context/scans/CORTEX.md +13 -0
- package/defaults/context/user/CORTEX.md +21 -0
- package/defaults/data/schedules.json +52 -0
- package/defaults/gitignore +44 -0
- package/defaults/hooks/ask-user-question-hook.mjs +66 -0
- package/defaults/hooks/cortex-md-injector.mjs +237 -0
- package/defaults/hooks/exit-plan-mode-hook.mjs +84 -0
- package/defaults/hooks/memory-ref-tracker.mjs +154 -0
- package/defaults/hooks/new-session-hook.mjs +83 -0
- package/defaults/hooks/post-task-hook.mjs +63 -0
- package/defaults/hooks/rules-loader.mjs +212 -0
- package/defaults/hooks/sensitive-file-edit.mjs +84 -0
- package/defaults/hooks/session-activity-tracker.mjs +254 -0
- package/defaults/hooks/task-status-check.mjs +218 -0
- package/defaults/hooks/tasks-yaml-guard.mjs +230 -0
- package/defaults/plugins/cortex-coder/.claude-plugin/plugin.json +5 -0
- package/defaults/plugins/cortex-coder/skills/cli-standards/SKILL.md +208 -0
- package/defaults/plugins/cortex-coder/skills/code-standards/SKILL.md +146 -0
- package/defaults/plugins/cortex-coder/skills/develop/SKILL.md +164 -0
- package/defaults/plugins/cortex-common/.claude-plugin/plugin.json +5 -0
- package/defaults/plugins/cortex-common/skills/compound/SKILL.md +349 -0
- package/defaults/plugins/cortex-common/skills/compound-simple/SKILL.md +104 -0
- package/defaults/plugins/cortex-common/skills/critique/SKILL.md +88 -0
- package/defaults/plugins/cortex-common/skills/debug-campaign/SKILL.md +508 -0
- package/defaults/plugins/cortex-common/skills/diagnose/SKILL.md +169 -0
- package/defaults/plugins/cortex-common/skills/postmortem/SKILL.md +135 -0
- package/defaults/plugins/cortex-common/skills/solution-design/SKILL.md +183 -0
- package/defaults/plugins/cortex-common/skills/synthesize/SKILL.md +120 -0
- package/defaults/plugins/cortex-stage-gate/.claude-plugin/plugin.json +5 -0
- package/defaults/plugins/cortex-stage-gate/skills/need-approval/SKILL.md +89 -0
- package/defaults/plugins/cortex-stage-gate/skills/reorient/SKILL.md +163 -0
- package/defaults/plugins/cortex-stage-gate/skills/task/SKILL.md +425 -0
- package/defaults/plugins/cortex-system/.claude-plugin/plugin.json +5 -0
- package/defaults/plugins/cortex-system/skills/approval/SKILL.md +84 -0
- package/defaults/plugins/cortex-system/skills/client-manage/SKILL.md +199 -0
- package/defaults/plugins/cortex-system/skills/deep-retrospective/CORTEX.md +8 -0
- package/defaults/plugins/cortex-system/skills/deep-retrospective/SKILL.md +201 -0
- package/defaults/plugins/cortex-system/skills/deep-retrospective/scripts/CORTEX.md +8 -0
- package/defaults/plugins/cortex-system/skills/deep-retrospective/scripts/extract_session.py +165 -0
- package/defaults/plugins/cortex-system/skills/deep-retrospective/scripts/scan_logs.py +402 -0
- package/defaults/plugins/cortex-system/skills/evolve/SKILL.md +115 -0
- package/defaults/plugins/cortex-system/skills/feedback/SKILL.md +262 -0
- package/defaults/plugins/cortex-system/skills/gravity/SKILL.md +125 -0
- package/defaults/plugins/cortex-system/skills/orient/SKILL.md +310 -0
- package/defaults/plugins/cortex-system/skills/orient-project/SKILL.md +85 -0
- package/defaults/plugins/cortex-system/skills/project-init/SKILL.md +167 -0
- package/defaults/plugins/cortex-system/skills/refresh-skills/SKILL.md +153 -0
- package/defaults/plugins/cortex-system/skills/schedule/SKILL.md +209 -0
- package/defaults/plugins/cortex-system/skills/thread/SKILL.md +478 -0
- package/defaults/plugins/cortex-system/skills/user-learn/SKILL.md +95 -0
- package/defaults/prompts/directives/coder-reviewer.md +106 -0
- package/defaults/prompts/directives/coder.md +90 -0
- package/defaults/prompts/directives/director.md +97 -0
- package/defaults/prompts/directives/doc-reviewer.md +93 -0
- package/defaults/prompts/directives/doc-writer.md +85 -0
- package/defaults/prompts/directives/executor-reviewer.md +96 -0
- package/defaults/prompts/directives/executor.md +85 -0
- package/defaults/prompts/directives/milestone-executor.md +119 -0
- package/defaults/prompts/directives/milestone-reviewer.md +108 -0
- package/defaults/prompts/directives/plan-executor.md +121 -0
- package/defaults/prompts/directives/plan-reviewer.md +99 -0
- package/defaults/prompts/systemPrompts/coder.md +64 -0
- package/defaults/prompts/systemPrompts/direct.md +92 -0
- package/defaults/prompts/systemPrompts/web-opus-4-6.md +68 -0
- package/defaults/prompts/systemPrompts/web-sonnet-4-6.md +76 -0
- package/defaults/prompts/systemPrompts/web.md +50 -0
- package/defaults/prompts/systemPrompts/worker.md +67 -0
- package/defaults/rules/correction-propagation.md +31 -0
- package/defaults/rules/decision-records.md +49 -0
- package/defaults/rules/experiment-format.md +165 -0
- package/defaults/rules/issues-md.md +37 -0
- package/defaults/rules/meta-conventions.md +45 -0
- package/defaults/rules/mission-md.md +47 -0
- package/defaults/rules/overview-md.md +41 -0
- package/defaults/rules/roadmap-md.md +55 -0
- package/defaults/rules/status-md.md +49 -0
- package/defaults/rules/task-system.md +53 -0
- package/dist/agent-adapter/capabilities.d.ts +12 -0
- package/dist/agent-adapter/capabilities.js +52 -0
- package/dist/agent-adapter/claude/adapter-tui.d.ts +140 -0
- package/dist/agent-adapter/claude/adapter-tui.js +422 -0
- package/dist/agent-adapter/claude/adapter.d.ts +85 -0
- package/dist/agent-adapter/claude/adapter.js +771 -0
- package/dist/agent-adapter/claude/cost-from-usage.d.ts +62 -0
- package/dist/agent-adapter/claude/cost-from-usage.js +97 -0
- package/dist/agent-adapter/claude/defaults.d.ts +30 -0
- package/dist/agent-adapter/claude/defaults.js +49 -0
- package/dist/agent-adapter/claude/event-parser.d.ts +28 -0
- package/dist/agent-adapter/claude/event-parser.js +173 -0
- package/dist/agent-adapter/claude/hooks-builder.d.ts +36 -0
- package/dist/agent-adapter/claude/hooks-builder.js +57 -0
- package/dist/agent-adapter/claude/jsonl-tail.d.ts +68 -0
- package/dist/agent-adapter/claude/jsonl-tail.js +344 -0
- package/dist/agent-adapter/claude/spawn-args.d.ts +38 -0
- package/dist/agent-adapter/claude/spawn-args.js +83 -0
- package/dist/agent-adapter/claude/tmux-control.d.ts +69 -0
- package/dist/agent-adapter/claude/tmux-control.js +127 -0
- package/dist/agent-adapter/claude/tool-summarizers.d.ts +2 -0
- package/dist/agent-adapter/claude/tool-summarizers.js +24 -0
- package/dist/agent-adapter/codex/adapter.d.ts +42 -0
- package/dist/agent-adapter/codex/adapter.js +916 -0
- package/dist/agent-adapter/codex/event-parser.d.ts +17 -0
- package/dist/agent-adapter/codex/event-parser.js +41 -0
- package/dist/agent-adapter/codex/spawn-args.d.ts +6 -0
- package/dist/agent-adapter/codex/spawn-args.js +30 -0
- package/dist/agent-adapter/index.d.ts +8 -0
- package/dist/agent-adapter/index.js +33 -0
- package/dist/agent-adapter/normalize/event-stream.d.ts +6 -0
- package/dist/agent-adapter/normalize/event-stream.js +47 -0
- package/dist/agent-adapter/normalize/event-types.d.ts +58 -0
- package/dist/agent-adapter/normalize/event-types.js +5 -0
- package/dist/agent-adapter/normalize/hooks.d.ts +26 -0
- package/dist/agent-adapter/normalize/hooks.js +5 -0
- package/dist/agent-adapter/normalize/prompt-builder.d.ts +6 -0
- package/dist/agent-adapter/normalize/prompt-builder.js +23 -0
- package/dist/agent-adapter/normalize/tool-names.d.ts +6 -0
- package/dist/agent-adapter/normalize/tool-names.js +73 -0
- package/dist/agent-adapter/pi/adapter.d.ts +60 -0
- package/dist/agent-adapter/pi/adapter.js +626 -0
- package/dist/agent-adapter/pi/agent-dir.d.ts +11 -0
- package/dist/agent-adapter/pi/agent-dir.js +34 -0
- package/dist/agent-adapter/pi/event-parser.d.ts +26 -0
- package/dist/agent-adapter/pi/event-parser.js +313 -0
- package/dist/agent-adapter/pi/framing.d.ts +6 -0
- package/dist/agent-adapter/pi/framing.js +35 -0
- package/dist/agent-adapter/pi/hook-bridge.d.ts +59 -0
- package/dist/agent-adapter/pi/hook-bridge.js +233 -0
- package/dist/agent-adapter/pi/mcp-bridge.d.ts +26 -0
- package/dist/agent-adapter/pi/mcp-bridge.js +140 -0
- package/dist/agent-adapter/pi/pi-ext-types.d.ts +90 -0
- package/dist/agent-adapter/pi/pi-ext-types.js +5 -0
- package/dist/agent-adapter/pi/spawn-args.d.ts +20 -0
- package/dist/agent-adapter/pi/spawn-args.js +54 -0
- package/dist/agent-adapter/pi/tool-shims.d.ts +2 -0
- package/dist/agent-adapter/pi/tool-shims.js +181 -0
- package/dist/agent-adapter/types.d.ts +94 -0
- package/dist/agent-adapter/types.js +5 -0
- package/dist/core/async-mutex.d.ts +6 -0
- package/dist/core/async-mutex.js +36 -0
- package/dist/core/cli-utils.d.ts +37 -0
- package/dist/core/cli-utils.js +69 -0
- package/dist/core/config-generator.d.ts +9 -0
- package/dist/core/config-generator.js +58 -0
- package/dist/core/gateway-generator.d.ts +46 -0
- package/dist/core/gateway-generator.js +336 -0
- package/dist/core/log.d.ts +7 -0
- package/dist/core/log.js +103 -0
- package/dist/core/paths.d.ts +32 -0
- package/dist/core/paths.js +49 -0
- package/dist/core/profile-generator.d.ts +65 -0
- package/dist/core/profile-generator.js +310 -0
- package/dist/core/running-executions.d.ts +88 -0
- package/dist/core/running-executions.js +186 -0
- package/dist/core/status-format.d.ts +18 -0
- package/dist/core/status-format.js +31 -0
- package/dist/core/task-parser.d.ts +69 -0
- package/dist/core/task-parser.js +423 -0
- package/dist/core/types/agent-types.d.ts +31 -0
- package/dist/core/types/agent-types.js +5 -0
- package/dist/core/types/thread-types.d.ts +261 -0
- package/dist/core/types/thread-types.js +5 -0
- package/dist/core/utils.d.ts +29 -0
- package/dist/core/utils.js +98 -0
- package/dist/core/version.d.ts +3 -0
- package/dist/core/version.js +12 -0
- package/dist/domain/agents/config.d.ts +58 -0
- package/dist/domain/agents/config.js +313 -0
- package/dist/domain/agents/facade.d.ts +52 -0
- package/dist/domain/agents/facade.js +264 -0
- package/dist/domain/agents/index.d.ts +2 -0
- package/dist/domain/agents/index.js +4 -0
- package/dist/domain/agents/profile-manager.d.ts +54 -0
- package/dist/domain/agents/profile-manager.js +161 -0
- package/dist/domain/costs/codex-event-format.d.ts +4 -0
- package/dist/domain/costs/codex-event-format.js +66 -0
- package/dist/domain/costs/codex-usage-monitor.d.ts +7 -0
- package/dist/domain/costs/codex-usage-monitor.js +72 -0
- package/dist/domain/costs/cost-tracker.d.ts +115 -0
- package/dist/domain/costs/cost-tracker.js +327 -0
- package/dist/domain/costs/gateway-manager.d.ts +6 -0
- package/dist/domain/costs/gateway-manager.js +228 -0
- package/dist/domain/costs/rate-limit-parser.d.ts +11 -0
- package/dist/domain/costs/rate-limit-parser.js +87 -0
- package/dist/domain/costs/rate-limit-throttle.d.ts +32 -0
- package/dist/domain/costs/rate-limit-throttle.js +129 -0
- package/dist/domain/executions/registry.d.ts +20 -0
- package/dist/domain/executions/registry.js +124 -0
- package/dist/domain/mcp/core-server.d.ts +2 -0
- package/dist/domain/mcp/core-server.js +34 -0
- package/dist/domain/mcp/server.d.ts +3 -0
- package/dist/domain/mcp/server.js +78 -0
- package/dist/domain/mcp/tools/context.d.ts +23 -0
- package/dist/domain/mcp/tools/context.js +51 -0
- package/dist/domain/mcp/tools/cortex-md.d.ts +17 -0
- package/dist/domain/mcp/tools/cortex-md.js +36 -0
- package/dist/domain/mcp/tools/cost.d.ts +2 -0
- package/dist/domain/mcp/tools/cost.js +54 -0
- package/dist/domain/mcp/tools/executions.d.ts +2 -0
- package/dist/domain/mcp/tools/executions.js +94 -0
- package/dist/domain/mcp/tools/schedule.d.ts +23 -0
- package/dist/domain/mcp/tools/schedule.js +245 -0
- package/dist/domain/mcp/tools/slack.d.ts +21 -0
- package/dist/domain/mcp/tools/slack.js +124 -0
- package/dist/domain/mcp/tools/task-ops.d.ts +2 -0
- package/dist/domain/mcp/tools/task-ops.js +509 -0
- package/dist/domain/mcp/tools/tui-ask.d.ts +31 -0
- package/dist/domain/mcp/tools/tui-ask.js +108 -0
- package/dist/domain/mcp/tools/tui-plan.d.ts +28 -0
- package/dist/domain/mcp/tools/tui-plan.js +118 -0
- package/dist/domain/mcp/tui-server.d.ts +2 -0
- package/dist/domain/mcp/tui-server.js +69 -0
- package/dist/domain/memory/consolidate.d.ts +55 -0
- package/dist/domain/memory/consolidate.js +471 -0
- package/dist/domain/memory/cortex-md-injector.d.ts +30 -0
- package/dist/domain/memory/cortex-md-injector.js +123 -0
- package/dist/domain/memory/cortex-md-scanner.d.ts +9 -0
- package/dist/domain/memory/cortex-md-scanner.js +67 -0
- package/dist/domain/memory/index-regen.d.ts +19 -0
- package/dist/domain/memory/index-regen.js +398 -0
- package/dist/domain/memory/rules-loader.d.ts +27 -0
- package/dist/domain/memory/rules-loader.js +97 -0
- package/dist/domain/memory/skill-scanner.d.ts +5 -0
- package/dist/domain/memory/skill-scanner.js +132 -0
- package/dist/domain/memory/user-context.d.ts +5 -0
- package/dist/domain/memory/user-context.js +34 -0
- package/dist/domain/memory/watcher.d.ts +2 -0
- package/dist/domain/memory/watcher.js +81 -0
- package/dist/domain/monitor/disk-monitor.d.ts +20 -0
- package/dist/domain/monitor/disk-monitor.js +97 -0
- package/dist/domain/monitor/gpu-monitor.d.ts +26 -0
- package/dist/domain/monitor/gpu-monitor.js +135 -0
- package/dist/domain/remote/client-bootstrap.d.ts +1 -0
- package/dist/domain/remote/client-bootstrap.js +139 -0
- package/dist/domain/remote/client-hot-reload.d.ts +18 -0
- package/dist/domain/remote/client-hot-reload.js +142 -0
- package/dist/domain/remote/client-manager.d.ts +50 -0
- package/dist/domain/remote/client-manager.js +452 -0
- package/dist/domain/remote/cortex-client.d.ts +1 -0
- package/dist/domain/remote/cortex-client.js +704 -0
- package/dist/domain/scheduling/job-registry.d.ts +31 -0
- package/dist/domain/scheduling/job-registry.js +34 -0
- package/dist/domain/scheduling/jobs/_shared.d.ts +14 -0
- package/dist/domain/scheduling/jobs/_shared.js +45 -0
- package/dist/domain/scheduling/jobs/memory-index-regen.d.ts +1 -0
- package/dist/domain/scheduling/jobs/memory-index-regen.js +16 -0
- package/dist/domain/scheduling/jobs/scheduled-task.d.ts +11 -0
- package/dist/domain/scheduling/jobs/scheduled-task.js +186 -0
- package/dist/domain/scheduling/jobs/target-dispatch.d.ts +41 -0
- package/dist/domain/scheduling/jobs/target-dispatch.js +48 -0
- package/dist/domain/scheduling/jobs/task-archive.d.ts +1 -0
- package/dist/domain/scheduling/jobs/task-archive.js +19 -0
- package/dist/domain/scheduling/jobs/task-dispatch.d.ts +12 -0
- package/dist/domain/scheduling/jobs/task-dispatch.js +214 -0
- package/dist/domain/scheduling/runner.d.ts +13 -0
- package/dist/domain/scheduling/runner.js +24 -0
- package/dist/domain/scheduling/schedule-cli.d.ts +16 -0
- package/dist/domain/scheduling/schedule-cli.js +268 -0
- package/dist/domain/scheduling/schedule-command.d.ts +4 -0
- package/dist/domain/scheduling/schedule-command.js +274 -0
- package/dist/domain/scheduling/scheduler.d.ts +86 -0
- package/dist/domain/scheduling/scheduler.js +544 -0
- package/dist/domain/sessions/session-backup.d.ts +49 -0
- package/dist/domain/sessions/session-backup.js +217 -0
- package/dist/domain/sessions/session-hooks.d.ts +103 -0
- package/dist/domain/sessions/session-hooks.js +311 -0
- package/dist/domain/sessions/session-registry.d.ts +21 -0
- package/dist/domain/sessions/session-registry.js +31 -0
- package/dist/domain/sessions/session.d.ts +3 -0
- package/dist/domain/sessions/session.js +14 -0
- package/dist/domain/tasks/archiver.d.ts +9 -0
- package/dist/domain/tasks/archiver.js +123 -0
- package/dist/domain/tasks/dispatch-utils.d.ts +37 -0
- package/dist/domain/tasks/dispatch-utils.js +143 -0
- package/dist/domain/tasks/dispatcher.d.ts +48 -0
- package/dist/domain/tasks/dispatcher.js +285 -0
- package/dist/domain/tasks/lint.d.ts +12 -0
- package/dist/domain/tasks/lint.js +102 -0
- package/dist/domain/tasks/mutator.d.ts +21 -0
- package/dist/domain/tasks/mutator.js +208 -0
- package/dist/domain/tasks/parser.d.ts +1 -0
- package/dist/domain/tasks/parser.js +6 -0
- package/dist/domain/tasks/pending-tracker.d.ts +67 -0
- package/dist/domain/tasks/pending-tracker.js +163 -0
- package/dist/domain/tasks/recommendation/extractor.d.ts +12 -0
- package/dist/domain/tasks/recommendation/extractor.js +563 -0
- package/dist/domain/tasks/recommendation/patterns.d.ts +11 -0
- package/dist/domain/tasks/recommendation/patterns.js +99 -0
- package/dist/domain/tasks/recommendation/types.d.ts +67 -0
- package/dist/domain/tasks/recommendation/types.js +5 -0
- package/dist/domain/tasks/store.d.ts +1 -0
- package/dist/domain/tasks/store.js +3 -0
- package/dist/domain/tasks/system/cortex-run.d.ts +24 -0
- package/dist/domain/tasks/system/cortex-run.js +342 -0
- package/dist/domain/tasks/system/task-cli.d.ts +49 -0
- package/dist/domain/tasks/system/task-cli.js +664 -0
- package/dist/domain/tasks/system/task-completion.d.ts +22 -0
- package/dist/domain/tasks/system/task-completion.js +89 -0
- package/dist/domain/tasks/system/task-id-utils.d.ts +24 -0
- package/dist/domain/tasks/system/task-id-utils.js +84 -0
- package/dist/domain/tasks/system/task-lifecycle-edit.d.ts +34 -0
- package/dist/domain/tasks/system/task-lifecycle-edit.js +208 -0
- package/dist/domain/tasks/system/task-lock.d.ts +25 -0
- package/dist/domain/tasks/system/task-lock.js +139 -0
- package/dist/domain/tasks/system/task-mutations.d.ts +31 -0
- package/dist/domain/tasks/system/task-mutations.js +110 -0
- package/dist/domain/tasks/system/task-process.d.ts +37 -0
- package/dist/domain/tasks/system/task-process.js +119 -0
- package/dist/domain/tasks/system/task-state.d.ts +70 -0
- package/dist/domain/tasks/system/task-state.js +176 -0
- package/dist/domain/threads/artifact-io.d.ts +18 -0
- package/dist/domain/threads/artifact-io.js +182 -0
- package/dist/domain/threads/auto-thread.d.ts +3 -0
- package/dist/domain/threads/auto-thread.js +19 -0
- package/dist/domain/threads/hook-runner.d.ts +4 -0
- package/dist/domain/threads/hook-runner.js +250 -0
- package/dist/domain/threads/index.d.ts +5 -0
- package/dist/domain/threads/index.js +7 -0
- package/dist/domain/threads/prompt-builder.d.ts +25 -0
- package/dist/domain/threads/prompt-builder.js +176 -0
- package/dist/domain/threads/runner.d.ts +83 -0
- package/dist/domain/threads/runner.js +434 -0
- package/dist/domain/threads/state-machine.d.ts +61 -0
- package/dist/domain/threads/state-machine.js +440 -0
- package/dist/domain/threads/template-loader.d.ts +20 -0
- package/dist/domain/threads/template-loader.js +189 -0
- package/dist/domain/threads/template-resolver.d.ts +1 -0
- package/dist/domain/threads/template-resolver.js +95 -0
- package/dist/domain/threads/utils.d.ts +19 -0
- package/dist/domain/threads/utils.js +49 -0
- package/dist/entry/app.d.ts +1 -0
- package/dist/entry/app.js +234 -0
- package/dist/entry/cli.d.ts +12 -0
- package/dist/entry/cli.js +254 -0
- package/dist/entry/daemon.d.ts +11 -0
- package/dist/entry/daemon.js +521 -0
- package/dist/entry/init.d.ts +93 -0
- package/dist/entry/init.js +1299 -0
- package/dist/entry/startup-helpers.d.ts +2 -0
- package/dist/entry/startup-helpers.js +56 -0
- package/dist/entry/startup-notify.d.ts +10 -0
- package/dist/entry/startup-notify.js +20 -0
- package/dist/events/event-bus.d.ts +42 -0
- package/dist/events/event-bus.js +84 -0
- package/dist/events/event-logger.d.ts +12 -0
- package/dist/events/event-logger.js +135 -0
- package/dist/events/event-replay.d.ts +1 -0
- package/dist/events/event-replay.js +51 -0
- package/dist/events/event-types.d.ts +145 -0
- package/dist/events/event-types.js +5 -0
- package/dist/events/index.d.ts +5 -0
- package/dist/events/index.js +6 -0
- package/dist/hooks/ask-user-question-hook.mjs +66 -0
- package/dist/hooks/cortex-md-injector.mjs +237 -0
- package/dist/hooks/exit-plan-mode-hook.mjs +84 -0
- package/dist/hooks/memory-ref-tracker.mjs +154 -0
- package/dist/hooks/new-session-hook.mjs +83 -0
- package/dist/hooks/post-task-hook.mjs +63 -0
- package/dist/hooks/rules-loader.mjs +212 -0
- package/dist/hooks/sensitive-file-edit.mjs +84 -0
- package/dist/hooks/session-activity-tracker.mjs +254 -0
- package/dist/hooks/task-status-check.mjs +218 -0
- package/dist/hooks/tasks-yaml-guard.mjs +230 -0
- package/dist/orchestration/agent-runner.d.ts +72 -0
- package/dist/orchestration/agent-runner.js +289 -0
- package/dist/orchestration/busy-tracker.d.ts +12 -0
- package/dist/orchestration/busy-tracker.js +35 -0
- package/dist/orchestration/channel-queue.d.ts +18 -0
- package/dist/orchestration/channel-queue.js +32 -0
- package/dist/orchestration/dispatch-reconciler.d.ts +1 -0
- package/dist/orchestration/dispatch-reconciler.js +16 -0
- package/dist/orchestration/durable-helpers.d.ts +4 -0
- package/dist/orchestration/durable-helpers.js +42 -0
- package/dist/orchestration/interactions/ask-user-question.d.ts +32 -0
- package/dist/orchestration/interactions/ask-user-question.js +182 -0
- package/dist/orchestration/interactions/command-action-router.d.ts +47 -0
- package/dist/orchestration/interactions/command-action-router.js +91 -0
- package/dist/orchestration/interactions/interaction-handlers.d.ts +5 -0
- package/dist/orchestration/interactions/interaction-handlers.js +279 -0
- package/dist/orchestration/interactions/plan-approvals.d.ts +47 -0
- package/dist/orchestration/interactions/plan-approvals.js +77 -0
- package/dist/orchestration/interactions/plan-handler.d.ts +6 -0
- package/dist/orchestration/interactions/plan-handler.js +12 -0
- package/dist/orchestration/lifecycle.d.ts +50 -0
- package/dist/orchestration/lifecycle.js +308 -0
- package/dist/orchestration/orchestrator.d.ts +29 -0
- package/dist/orchestration/orchestrator.js +25 -0
- package/dist/orchestration/routing/commands/cancel.d.ts +10 -0
- package/dist/orchestration/routing/commands/cancel.js +136 -0
- package/dist/orchestration/routing/commands/channel.d.ts +11 -0
- package/dist/orchestration/routing/commands/channel.js +219 -0
- package/dist/orchestration/routing/commands/command-context.d.ts +29 -0
- package/dist/orchestration/routing/commands/command-context.js +4 -0
- package/dist/orchestration/routing/commands/cost.d.ts +3 -0
- package/dist/orchestration/routing/commands/cost.js +22 -0
- package/dist/orchestration/routing/commands/device.d.ts +6 -0
- package/dist/orchestration/routing/commands/device.js +83 -0
- package/dist/orchestration/routing/commands/dispatch.d.ts +2 -0
- package/dist/orchestration/routing/commands/dispatch.js +49 -0
- package/dist/orchestration/routing/commands/index.d.ts +15 -0
- package/dist/orchestration/routing/commands/index.js +130 -0
- package/dist/orchestration/routing/commands/mode.d.ts +13 -0
- package/dist/orchestration/routing/commands/mode.js +290 -0
- package/dist/orchestration/routing/commands/nvtop.d.ts +3 -0
- package/dist/orchestration/routing/commands/nvtop.js +103 -0
- package/dist/orchestration/routing/commands/orient.d.ts +2 -0
- package/dist/orchestration/routing/commands/orient.js +3 -0
- package/dist/orchestration/routing/commands/schedule.d.ts +4 -0
- package/dist/orchestration/routing/commands/schedule.js +132 -0
- package/dist/orchestration/routing/commands/sendfile.d.ts +2 -0
- package/dist/orchestration/routing/commands/sendfile.js +92 -0
- package/dist/orchestration/routing/commands/session.d.ts +9 -0
- package/dist/orchestration/routing/commands/session.js +153 -0
- package/dist/orchestration/routing/commands/status.d.ts +7 -0
- package/dist/orchestration/routing/commands/status.js +180 -0
- package/dist/orchestration/routing/commands/tail.d.ts +2 -0
- package/dist/orchestration/routing/commands/tail.js +73 -0
- package/dist/orchestration/routing/commands/task.d.ts +6 -0
- package/dist/orchestration/routing/commands/task.js +142 -0
- package/dist/orchestration/routing/commands/thread-handlers.d.ts +2 -0
- package/dist/orchestration/routing/commands/thread-handlers.js +138 -0
- package/dist/orchestration/routing/commands/thread.d.ts +2 -0
- package/dist/orchestration/routing/commands/thread.js +2 -0
- package/dist/orchestration/routing/edit-handler.d.ts +24 -0
- package/dist/orchestration/routing/edit-handler.js +161 -0
- package/dist/orchestration/routing/file-handler.d.ts +6 -0
- package/dist/orchestration/routing/file-handler.js +23 -0
- package/dist/orchestration/routing/hook-bridge-subscribers.d.ts +4 -0
- package/dist/orchestration/routing/hook-bridge-subscribers.js +79 -0
- package/dist/orchestration/routing/hook-bridge.d.ts +30 -0
- package/dist/orchestration/routing/hook-bridge.js +112 -0
- package/dist/orchestration/routing/message-router.d.ts +6 -0
- package/dist/orchestration/routing/message-router.js +70 -0
- package/dist/orchestration/routing/webhook.d.ts +10 -0
- package/dist/orchestration/routing/webhook.js +239 -0
- package/dist/orchestration/status-helpers.d.ts +66 -0
- package/dist/orchestration/status-helpers.js +222 -0
- package/dist/orchestration/superseded-edits.d.ts +22 -0
- package/dist/orchestration/superseded-edits.js +31 -0
- package/dist/orchestration/thread-executor.d.ts +31 -0
- package/dist/orchestration/thread-executor.js +234 -0
- package/dist/platform/adapter.d.ts +28 -0
- package/dist/platform/adapter.js +5 -0
- package/dist/platform/adapters/feishu.d.ts +66 -0
- package/dist/platform/adapters/feishu.js +558 -0
- package/dist/platform/adapters/index.d.ts +16 -0
- package/dist/platform/adapters/index.js +65 -0
- package/dist/platform/adapters/slack.d.ts +90 -0
- package/dist/platform/adapters/slack.js +630 -0
- package/dist/platform/index.d.ts +12 -0
- package/dist/platform/index.js +10 -0
- package/dist/platform/interactive-builder.d.ts +27 -0
- package/dist/platform/interactive-builder.js +120 -0
- package/dist/platform/testing.d.ts +100 -0
- package/dist/platform/testing.js +190 -0
- package/dist/platform/tool-trace.d.ts +33 -0
- package/dist/platform/tool-trace.js +165 -0
- package/dist/platform/types.d.ts +176 -0
- package/dist/platform/types.js +5 -0
- package/dist/platform/utils/rate-limiter.d.ts +92 -0
- package/dist/platform/utils/rate-limiter.js +213 -0
- package/dist/platform/virtual-message.d.ts +68 -0
- package/dist/platform/virtual-message.js +464 -0
- package/dist/store/atomic-write.d.ts +6 -0
- package/dist/store/atomic-write.js +18 -0
- package/dist/store/channel-repo.d.ts +21 -0
- package/dist/store/channel-repo.js +55 -0
- package/dist/store/conversation-ledger-repo.d.ts +86 -0
- package/dist/store/conversation-ledger-repo.js +220 -0
- package/dist/store/cost-repo.d.ts +57 -0
- package/dist/store/cost-repo.js +135 -0
- package/dist/store/execution-repo.d.ts +172 -0
- package/dist/store/execution-repo.js +343 -0
- package/dist/store/in-memory-repository.d.ts +14 -0
- package/dist/store/in-memory-repository.js +31 -0
- package/dist/store/json-repository.d.ts +51 -0
- package/dist/store/json-repository.js +118 -0
- package/dist/store/outbound-queue.d.ts +65 -0
- package/dist/store/outbound-queue.js +269 -0
- package/dist/store/profile-repo.d.ts +36 -0
- package/dist/store/profile-repo.js +144 -0
- package/dist/store/project-dir-repo.d.ts +22 -0
- package/dist/store/project-dir-repo.js +60 -0
- package/dist/store/schedule-repo.d.ts +92 -0
- package/dist/store/schedule-repo.js +88 -0
- package/dist/store/session-registry-repo.d.ts +38 -0
- package/dist/store/session-registry-repo.js +96 -0
- package/dist/store/session-repo.d.ts +14 -0
- package/dist/store/session-repo.js +56 -0
- package/dist/store/task-repo.d.ts +41 -0
- package/dist/store/task-repo.js +137 -0
- package/dist/store/thread-repo.d.ts +50 -0
- package/dist/store/thread-repo.js +190 -0
- package/package.json +58 -0
- package/scripts/postinstall-restart-trigger.mjs +39 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reorient
|
|
3
|
+
description: "Use when a project undergoes a direction change — reorientation, scope redefine, approach revert, or major pivot. This skill ensures that ALL context files are updated consistently, not just the obvious ones. Invoke this skill proactively whenever you find yourself changing a project's current phase in STATUS.md, redefining milestones in roadmap.md, deprecating experiments, or reverting an approach. Also use when the user says 'pivot', 'redefine scope', 'revert approach', 'change direction', or 'direction has changed'. The reason this skill exists: context files must be consistent because each session starts fresh with no memory. If you update STATUS.md but forget to update mission.md, CORTEX.md index, or existing TASKS entries, the next session will execute based on stale information — potentially wasting hours of GPU time on the wrong configuration."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Write
|
|
7
|
+
- Edit
|
|
8
|
+
- Bash
|
|
9
|
+
- Grep
|
|
10
|
+
- Glob
|
|
11
|
+
- Agent
|
|
12
|
+
argument-hint: "<project-name>"
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Reorient
|
|
16
|
+
|
|
17
|
+
You are performing a **project reorientation** — a systematic propagation of a direction change across all context files.
|
|
18
|
+
|
|
19
|
+
This skill exists because of a repeatedly observed failure mode: when a project changes direction, the session that makes the change updates the "core" files (STATUS.md, roadmap.md, new TASKS entries) but misses "peripheral" targets (mission.md, CORTEX.md index, existing task descriptions, experiment deprecation notices, decision records). Fleet workers then faithfully execute stale instructions, producing wasted or wrong work.
|
|
20
|
+
|
|
21
|
+
Real examples that motivated this skill:
|
|
22
|
+
- A task said "test_lights evaluation" but eval config had changed to L1-only → 1.5h GPU wasted
|
|
23
|
+
- Project reoriented from symmetric to directed inference, but mission.md/roadmap.md never updated
|
|
24
|
+
- CORTEX.md experiment index still described a deprecated range after R1 was redefined
|
|
25
|
+
- New tasks created with `[[double-brackets]]` broke the parser for 3 hours
|
|
26
|
+
|
|
27
|
+
The core principle: **a direction change is not complete until every file a fleet worker might read has been checked for consistency.**
|
|
28
|
+
|
|
29
|
+
## Target
|
|
30
|
+
|
|
31
|
+
$ARGUMENTS
|
|
32
|
+
|
|
33
|
+
If a project name is provided, reorient that project. If empty, ask which project is being reoriented.
|
|
34
|
+
|
|
35
|
+
## Step 1: Declare the Change
|
|
36
|
+
|
|
37
|
+
Before touching any files, articulate the change clearly. Write these three items (you'll include them in the final commit and checklist):
|
|
38
|
+
|
|
39
|
+
1. **What changed**: `<old direction>` → `<new direction>`
|
|
40
|
+
2. **Why**: the trigger (failed experiment, user feedback, new evidence)
|
|
41
|
+
3. **Scope of impact**: which milestones, experiments, and tasks are affected
|
|
42
|
+
|
|
43
|
+
If you're already in the middle of making the change (e.g., you just updated STATUS.md), reconstruct this declaration from what you've already done. The declaration doesn't need to be a separate document — it's the mental model that guides the propagation scan.
|
|
44
|
+
|
|
45
|
+
## Step 2: Update Core Files
|
|
46
|
+
|
|
47
|
+
These are the files that directly express the change. Update them first:
|
|
48
|
+
|
|
49
|
+
| File | What to update |
|
|
50
|
+
|------|---------------|
|
|
51
|
+
| `STATUS.md` | Current Phase/Focus section to reflect new direction |
|
|
52
|
+
| `roadmap.md` | Affected milestone definitions and verification conditions |
|
|
53
|
+
| `experiments/index.md` | Mark affected experiments as `superseded` or `deprecated` in the index table |
|
|
54
|
+
|
|
55
|
+
If any of these are already updated (because you did it before invoking this skill), skip to Step 3. The value of this skill is in Step 3, not Step 2.
|
|
56
|
+
|
|
57
|
+
## Step 3: Propagation Scan
|
|
58
|
+
|
|
59
|
+
This is the critical step. Scan every `.md` file in the project directory and check consistency with the new direction.
|
|
60
|
+
|
|
61
|
+
### 3a. Discover all files
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
find context/projects/<project>/ -name "*.md" -type f
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3b. Check each file against the new direction
|
|
68
|
+
|
|
69
|
+
For each file, read it and assess:
|
|
70
|
+
|
|
71
|
+
| File | What to check |
|
|
72
|
+
|------|--------------|
|
|
73
|
+
| **mission.md** | Problem definition, success criteria — still accurate? (Needs user confirmation to modify per safety rules) |
|
|
74
|
+
| **CORTEX.md** (project-level) | Index descriptions — do they reflect current experiment range, file structure, phase? |
|
|
75
|
+
| **idea.md** (if exists) | Framing, hypothesis — still aligned with new direction? |
|
|
76
|
+
| **knowledge/** (if exists) | Any knowledge entries (knowledge/K-NNN.md) based on now-deprecated experiment conclusions? |
|
|
77
|
+
| **ISSUES.md** | Any issues that are resolved or irrelevant under new direction? |
|
|
78
|
+
| **decisions/** (all files) | Any DR that references the old framing or old assumptions? Update Status line if superseded. |
|
|
79
|
+
| **TASKS.md** (per-task) | See detailed task check below |
|
|
80
|
+
| **Other .md files** | Any project-specific docs (codebase docs, asset plans, etc.) — stale references? |
|
|
81
|
+
|
|
82
|
+
### 3c. Detailed TASKS.md check
|
|
83
|
+
|
|
84
|
+
This is where most fleet drift originates. Check **every uncompleted task** individually:
|
|
85
|
+
|
|
86
|
+
For each `- [ ]` task:
|
|
87
|
+
1. **Description accuracy**: Does the task text match the new direction? Watch for:
|
|
88
|
+
- Eval configurations that changed (e.g., "test_lights" vs "L1-only")
|
|
89
|
+
- Method names that changed (e.g., "symmetric" vs "directed")
|
|
90
|
+
- Experiment IDs that were deprecated
|
|
91
|
+
- Checkpoint references that are no longer valid
|
|
92
|
+
2. **Dependency validity**: Are `[depends-on: XXXX]` targets still relevant?
|
|
93
|
+
3. **Tag formatting**: Verify `[single-brackets]`, not `[[double-brackets]]` or malformed nesting
|
|
94
|
+
4. **Blocked-by gates**: Should Phase N tasks have a validation gate (e.g., `[blocked-by: user confirms X]`)?
|
|
95
|
+
|
|
96
|
+
If a task is stale but you can confidently update it → update the description.
|
|
97
|
+
If a task is stale and you're unsure how to update it → add `[blocked-by: context-stale — needs review after reorientation]`.
|
|
98
|
+
|
|
99
|
+
### 3d. Check OVERVIEW.md
|
|
100
|
+
|
|
101
|
+
Read `context/OVERVIEW.md` and verify the project's one-line status is still accurate.
|
|
102
|
+
|
|
103
|
+
## Step 4: Execute Updates
|
|
104
|
+
|
|
105
|
+
Update all files marked as needing changes in Step 3.
|
|
106
|
+
|
|
107
|
+
Important constraints:
|
|
108
|
+
- **mission.md modifications require user confirmation** (per CORTEX.md safety boundary). If mission.md needs updating, flag it in the checklist and ask the user.
|
|
109
|
+
- **Don't create new decision records** — the reorient skill handles propagation, not decision-making. The direction change itself should already be documented by whatever triggered it.
|
|
110
|
+
- **Deprecated experiment full-text entries**: If you marked experiments as deprecated in the index (Step 2), also add a deprecation notice to the full-text entry body so that a worker reading only the full text (not the index) sees the deprecation.
|
|
111
|
+
|
|
112
|
+
## Step 5: Propagation Checklist
|
|
113
|
+
|
|
114
|
+
Output a complete verification table. This is the deliverable of the reorient skill — it proves every file was checked.
|
|
115
|
+
|
|
116
|
+
```markdown
|
|
117
|
+
## Reorientation Propagation Checklist
|
|
118
|
+
|
|
119
|
+
**Project**: <project-name>
|
|
120
|
+
**Change**: <old direction> → <new direction>
|
|
121
|
+
**Trigger**: <why the change happened>
|
|
122
|
+
**Date**: YYYY-MM-DD
|
|
123
|
+
|
|
124
|
+
| # | File | Status | Change Summary |
|
|
125
|
+
|---|------|--------|---------------|
|
|
126
|
+
| 1 | STATUS.md | updated | Current phase → X |
|
|
127
|
+
| 2 | roadmap.md | updated | M2 redefined: ... |
|
|
128
|
+
| 3 | mission.md | no change needed | Problem definition unaffected |
|
|
129
|
+
| 4 | CORTEX.md | updated | Experiment index range corrected |
|
|
130
|
+
| 5 | TASKS.md (b2b4) | updated | eval scope → L1-only |
|
|
131
|
+
| 6 | TASKS.md (ac1d) | blocked | context-stale: needs user review |
|
|
132
|
+
| ... | ... | ... | ... |
|
|
133
|
+
|
|
134
|
+
**Files checked**: N/N
|
|
135
|
+
**Tasks checked**: N uncompleted tasks
|
|
136
|
+
**Stale tasks blocked**: N
|
|
137
|
+
**Needs user confirmation**: mission.md (yes/no)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Status values:
|
|
141
|
+
- `updated` — Changed in this reorient
|
|
142
|
+
- `no change needed` — Checked and consistent
|
|
143
|
+
- `blocked` — Marked context-stale, needs human review
|
|
144
|
+
- `needs confirmation` — Requires user approval (e.g., mission.md)
|
|
145
|
+
- `already current` — Was updated before this skill was invoked
|
|
146
|
+
|
|
147
|
+
## Step 6: Commit
|
|
148
|
+
|
|
149
|
+
Commit all changes as a single atomic commit:
|
|
150
|
+
|
|
151
|
+
```
|
|
152
|
+
<project>: reorient — <old direction summary> → <new direction summary>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Include the propagation checklist summary in the commit body (how many files checked, how many updated, how many tasks blocked).
|
|
156
|
+
|
|
157
|
+
## Behavior Guidance
|
|
158
|
+
|
|
159
|
+
- **Be thorough, not fast.** The whole point of this skill is to catch what you'd normally miss. Reading every file in the project directory takes 2 minutes; missing a stale task costs hours.
|
|
160
|
+
- **Check existing tasks individually.** The most common drift is in task descriptions. Don't just scan TASKS.md as a whole — read each uncompleted task line by line.
|
|
161
|
+
- **When in doubt, block the task.** Adding `[blocked-by: context-stale]` is cheap and reversible. A fleet worker executing a stale task is expensive and irreversible.
|
|
162
|
+
- **This skill is idempotent.** Running it twice should produce no additional changes if the first run was thorough.
|
|
163
|
+
- **Don't skip files because they "probably" don't matter.** The retrospective showed that mission.md, idea.md, and project CORTEX.md are the most commonly missed — precisely because they seem peripheral.
|
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: task
|
|
3
|
+
description: "MUST Use when adding, editing, querying, or managing cortex tasks — includes task creation conventions (format, tagging, decomposition rules). MUST use before using cortex-task CLI."
|
|
4
|
+
author: Cortex
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
allowed-tools:
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Edit
|
|
10
|
+
- Bash
|
|
11
|
+
date: 2026-04-25
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Task
|
|
15
|
+
|
|
16
|
+
You are Cortex, managing the TASKS.yaml task system.
|
|
17
|
+
|
|
18
|
+
## Arguments
|
|
19
|
+
$ARGUMENTS
|
|
20
|
+
|
|
21
|
+
The task system has a single canonical CLI: `cortex-task`
|
|
22
|
+
(source: `agent-server/src/task-system/task-cli.ts`). Both read and write
|
|
23
|
+
operations live behind subcommands. Run `cortex-task --help` for
|
|
24
|
+
the full reference. Use this CLI as the source of truth for task operations
|
|
25
|
+
instead of manually editing `TASKS.yaml` when a canonical command exists.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Canonical CLI Usage
|
|
30
|
+
|
|
31
|
+
## Lock Rules
|
|
32
|
+
|
|
33
|
+
TASKS.yaml uses a file-level lock mechanism to prevent incorrect dispatch by the dispatcher during editing. Lock records are stored in the `lock:` field at the top level of `TASKS.yaml`.
|
|
34
|
+
|
|
35
|
+
### Commands requiring a lock
|
|
36
|
+
|
|
37
|
+
The following mutation commands **must** hold the project lock first, otherwise they will exit with an error:
|
|
38
|
+
|
|
39
|
+
- `add` — Add a new task
|
|
40
|
+
- `edit` — Edit task fields
|
|
41
|
+
- `batch-edit` — Batch edit
|
|
42
|
+
- `decompose` — Decompose into subtasks
|
|
43
|
+
- `assign-ids` — Assign task IDs
|
|
44
|
+
|
|
45
|
+
Lifecycle commands (claim / complete / block / unblock / pause / resume / approval series / stop, etc.) **do not need** a lock — they are called routinely by the dispatcher and cortex-run on automated paths.
|
|
46
|
+
|
|
47
|
+
### Lock semantics
|
|
48
|
+
|
|
49
|
+
| Concept | Description |
|
|
50
|
+
|---------|-------------|
|
|
51
|
+
| **owner** | Lock holder identifier: prefers `$CORTEX_EXECUTION_ID`, falls back to `manual:<user>:<pid>` |
|
|
52
|
+
| **TTL** | Fixed 20 minutes. TTL is a safety net — the onMessageEnd hook reminds the agent to release |
|
|
53
|
+
| **force** | Expired locks can be forcefully preempted with `--force`, recording a force warning |
|
|
54
|
+
| **release** | `lock-release` only releases when owner matches; `lock-force-release` releases unconditionally |
|
|
55
|
+
|
|
56
|
+
### Hook interception
|
|
57
|
+
|
|
58
|
+
**Direct editing of `TASKS.yaml` is prohibited.** The PreToolUse hook intercepts Edit/Write operations on `**/TASKS.yaml`:
|
|
59
|
+
- Without lock → rejected with prompt to use `cortex-task` CLI
|
|
60
|
+
- With lock → allowed (the lock itself guarantees exclusivity)
|
|
61
|
+
|
|
62
|
+
### Typical multi-step edit workflow
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# 1. Acquire project lock
|
|
66
|
+
cortex-task lock-acquire --project foo --note "splitting EXP-017 task"
|
|
67
|
+
|
|
68
|
+
# 2. Edit/add tasks
|
|
69
|
+
cortex-task edit --project foo --task-id ab12 --done-when "..."
|
|
70
|
+
cortex-task add --project foo --text "..." --why "..." --done-when "..." --plan ... --template ...
|
|
71
|
+
|
|
72
|
+
# 3. Release lock
|
|
73
|
+
cortex-task lock-release --project foo
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
### Read (no mutation)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
cortex-task --help
|
|
82
|
+
cortex-task list # actionable, sorted by project priority
|
|
83
|
+
cortex-task list --all --json # all tasks (incl. completed) as JSON
|
|
84
|
+
cortex-task stats # supply statistics per project
|
|
85
|
+
cortex-task query --project <project> [--status <status>] [--priority <p>] [--text <s>] [--task-id <id>] [--has-deps] [--no-deps] [--json]
|
|
86
|
+
cortex-task show --task-id <id> [--json]
|
|
87
|
+
cortex-task deps --task-id <id> [--json]
|
|
88
|
+
cortex-task lint [--project <p>] [--json]
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Write (mutates TASKS.md)
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# State
|
|
95
|
+
cortex-task claim --project <p> (--task-id <id> | --task <text>) [--agent <name>]
|
|
96
|
+
cortex-task unclaim --project <p> --task-id <id>
|
|
97
|
+
cortex-task pause --project <p> --task-id <id>
|
|
98
|
+
cortex-task resume --project <p> --task-id <id>
|
|
99
|
+
cortex-task complete --project <p> --task-id <id> [--note <text>] [--skip-verify --skip-verify-reason <text>]
|
|
100
|
+
cortex-task uncomplete --project <p> --task-id <id>
|
|
101
|
+
|
|
102
|
+
# Approval
|
|
103
|
+
cortex-task request-approval --project <p> --task-id <id>
|
|
104
|
+
cortex-task approve --project <p> --task-id <id>
|
|
105
|
+
cortex-task clear-approval --project <p> --task-id <id>
|
|
106
|
+
|
|
107
|
+
# Blocking
|
|
108
|
+
cortex-task block --project <p> --task-id <id> --reason <text>
|
|
109
|
+
cortex-task unblock --project <p> --task-id <id>
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
# Mutation
|
|
113
|
+
cortex-task add --project <p> --text <t> --why <w> --done-when <c> --plan <path> --template <name> [--priority high|medium|low] [--depends-on <id> [...]]
|
|
114
|
+
cortex-task edit --project <p> --task-id <id> [--text <t>] [--why <w>] [--done-when <c>] [--plan <path>] [--priority <p>] \
|
|
115
|
+
[--depends-on <id> [...]] [--add-depends-on <id>] [--remove-depends-on <id>] [--clear-depends-on]
|
|
116
|
+
cortex-task batch-edit --project <p> --task-ids <id1,id2,...> [<edit flags>]
|
|
117
|
+
cortex-task decompose --project <p> --task-id <id> --subtasks-file <path|->
|
|
118
|
+
|
|
119
|
+
# Maintenance
|
|
120
|
+
cortex-task assign-ids [--project <p>]
|
|
121
|
+
cortex-task validate
|
|
122
|
+
cortex-task stop --task-id <dispatch-id-or-hash> [--dry-run]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Flag semantics (set vs incremental)
|
|
126
|
+
|
|
127
|
+
`--depends-on` is a **set / replace** flag:
|
|
128
|
+
- On `add`: define the initial value.
|
|
129
|
+
- On `edit`: replace the entire current list (use `--clear-depends-on` to clear).
|
|
130
|
+
|
|
131
|
+
For incremental edits (only on `edit` / `batch-edit`):
|
|
132
|
+
- Dependencies: `--add-depends-on <id>`, `--remove-depends-on <id>` (each repeatable).
|
|
133
|
+
|
|
134
|
+
`--depends-on` accepts **both** space-separated and repeatable forms:
|
|
135
|
+
```bash
|
|
136
|
+
--depends-on a111 a112 # space-separated
|
|
137
|
+
--depends-on a111 --depends-on a112 # repeatable
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Other notes
|
|
141
|
+
|
|
142
|
+
- `--dry-run` previews `stop` and `decompose` without mutating.
|
|
143
|
+
- `decompose --subtasks-file -` reads JSON from stdin (pipeline-friendly).
|
|
144
|
+
- All mutation commands return JSON (`task_id`, `agent`, `claimed_at`, …) on success.
|
|
145
|
+
- `stop` accepts either the dispatch ID (`dispatch_xxx`) or the TASKS.yaml hash; project is auto-resolved from `pending-tasks.json`.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Step 1: Read Current State
|
|
150
|
+
|
|
151
|
+
Common starting points:
|
|
152
|
+
- Actionable list: `cortex-task list --json`
|
|
153
|
+
- Full list (incl. completed): `cortex-task list --all --project <project> --json`
|
|
154
|
+
- Project-scoped filtered query: `cortex-task query --project <project> --json`
|
|
155
|
+
- Supply stats: `cortex-task stats --json`
|
|
156
|
+
- Single task details: `cortex-task show --task-id <id> --json`
|
|
157
|
+
- Dependency view: `cortex-task deps --task-id <id> --json`
|
|
158
|
+
|
|
159
|
+
Use `--json` when you need structured data for follow-up actions.
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Step 2: Determine Action
|
|
164
|
+
|
|
165
|
+
Parse `$ARGUMENTS` and map the request to the right subcommand.
|
|
166
|
+
|
|
167
|
+
### Path A — List / Query Tasks
|
|
168
|
+
|
|
169
|
+
Use `list` / `query` / `show` / `deps` / `lint` / `stats`.
|
|
170
|
+
|
|
171
|
+
Examples:
|
|
172
|
+
- Actionable list: `cortex-task list --json`
|
|
173
|
+
- All tasks in one project: `cortex-task list --all --project <project> --json`
|
|
174
|
+
- Filter: `cortex-task query --project <project> --status actionable --priority high --json`
|
|
175
|
+
- One task: `cortex-task show --task-id <id> --json`
|
|
176
|
+
- Dependencies: `cortex-task deps --task-id <id> --json`
|
|
177
|
+
- Lint a project: `cortex-task lint --project <project> --json`
|
|
178
|
+
|
|
179
|
+
### Path B — Mutate Task Lifecycle
|
|
180
|
+
|
|
181
|
+
Prefer `--task-id` when you have an ID. Use `--task <text>` only as fuzzy fallback (not allowed for `add`).
|
|
182
|
+
|
|
183
|
+
Examples:
|
|
184
|
+
- Claim: `cortex-task claim --project <project> --task-id <id> --agent cortex-<machine>`
|
|
185
|
+
- Complete: `cortex-task complete --project <project> --task-id <id> --note "Verified via smoke test"`
|
|
186
|
+
- Block: `cortex-task block --project <project> --task-id <id> --reason "waiting for approval"`
|
|
187
|
+
- Add: `cortex-task add --project <project> --text "Run ablation" --why "Isolate tactile contribution" --done-when "Results in EXP-017.md" --plan context/projects/<project>/experiments/EXP-017.md --priority high --template <name>`
|
|
188
|
+
- Set deps: `cortex-task edit --project <project> --task-id <id> --depends-on a111 a112` (replaces full list)
|
|
189
|
+
- Append a dep: `cortex-task edit --project <project> --task-id <id> --add-depends-on a113`
|
|
190
|
+
- Append a dep: `cortex-task edit --project <project> --task-id <id> --add-depends-on a114`
|
|
191
|
+
- Assign IDs: `cortex-task assign-ids --project <project>`
|
|
192
|
+
- Stop preview: `cortex-task stop --task-id <id> --dry-run`
|
|
193
|
+
|
|
194
|
+
If the user asks to decompose a task, prepare the subtasks JSON file first, then call `decompose`. Subtasks inherit the parent task's `[plan: ...]` tag; each subtask can override via `"plan": "<path>"`.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Step 3: Report Result
|
|
199
|
+
|
|
200
|
+
Summarize the result briefly and include the canonical CLI response when useful.
|
|
201
|
+
|
|
202
|
+
If the CLI reports an error, surface it directly instead of inferring a different outcome.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## Notes
|
|
207
|
+
|
|
208
|
+
- Prefer the canonical CLI over manual `TASKS.yaml` edits whenever a matching command exists.
|
|
209
|
+
- Show / deps require `--task-id`.
|
|
210
|
+
- All write commands except `assign-ids` / `validate` / `stop` require `--project`.
|
|
211
|
+
- `assign-ids` is the canonical way to backfill missing task IDs.
|
|
212
|
+
- **`add` required**: `--text`, `--why`, `--done-when`, `--plan`, `--template`. Omitting `--text` or `--template` is rejected.
|
|
213
|
+
- **Manual Task ID is prohibited**: New tasks must be created via the `add` command; directly editing TASKS.yaml to write IDs is forbidden.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Task Creation Conventions
|
|
218
|
+
|
|
219
|
+
### TASKS.yaml Format
|
|
220
|
+
|
|
221
|
+
```yaml
|
|
222
|
+
tasks:
|
|
223
|
+
- id: c8a2
|
|
224
|
+
text: "Task description starting with a verb"
|
|
225
|
+
why: "Why this task needs to be done"
|
|
226
|
+
done-when: "Verifiable completion condition"
|
|
227
|
+
priority: medium # high | medium | low
|
|
228
|
+
status: open # open | done
|
|
229
|
+
template: <thread-template-name>
|
|
230
|
+
plan: path/to/design-doc.md
|
|
231
|
+
# Optional fields (defaults apply when omitted)
|
|
232
|
+
depends-on: [a1b2]
|
|
233
|
+
gpu: <machine-name>
|
|
234
|
+
blocked-by: "Blocking reason"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Field Descriptions
|
|
238
|
+
|
|
239
|
+
#### Lifecycle Fields
|
|
240
|
+
|
|
241
|
+
| Field | Type | Description |
|
|
242
|
+
|-------|------|-------------|
|
|
243
|
+
| `id` | string (4-char hex) | Unique task identifier, auto-generated by `add` |
|
|
244
|
+
| `text` | string | Task description starting with a verb |
|
|
245
|
+
| `why` | string | Why this task needs to be done |
|
|
246
|
+
| `done-when` | string | Verifiable completion condition |
|
|
247
|
+
| `priority` | enum | high / medium / low |
|
|
248
|
+
| `status` | enum | open / done |
|
|
249
|
+
| `claimed-by` | string? | Claiming agent name |
|
|
250
|
+
| `claimed-at` | string? | Claim date |
|
|
251
|
+
| `paused` | bool | Task paused, not participating in dispatch |
|
|
252
|
+
| `blocked-by` | string? | External blocking reason |
|
|
253
|
+
| `approval-needed` | bool | Requires user confirmation |
|
|
254
|
+
| `approved-at` | string? | Approval date |
|
|
255
|
+
| `gpu` | string? | GPU machine name |
|
|
256
|
+
| `gpu-count` | number | Number of GPUs, default 1 |
|
|
257
|
+
| `depends-on` | string[] | List of prerequisite task IDs |
|
|
258
|
+
| `plan` | string | Design document path (required) |
|
|
259
|
+
| `not-before` | string? | Earliest executable date |
|
|
260
|
+
| `completed-at` | string? | Completion date |
|
|
261
|
+
| `completed-note` | string? | Completion note |
|
|
262
|
+
|
|
263
|
+
**Note**: `blocked-by` is for actions outside agent control (user approval, external team, prerequisite task completion). `depends-on` is for machine-resolvable dependencies between tasks; when a prerequisite task is `complete`, all references to that ID across projects are automatically cleared.
|
|
264
|
+
|
|
265
|
+
#### Template Field (Required)
|
|
266
|
+
|
|
267
|
+
`template` — Specifies the thread template used for dispatch. **Every task must have this field**, no default value. Run `cortex-task add --help` or `!thread templates` to see the current list of available templates.
|
|
268
|
+
|
|
269
|
+
### Plan Reference Requirements
|
|
270
|
+
|
|
271
|
+
**Every task must reference an existing markdown document via `--plan <path>`** as the design/plan source for the task. The `plan` field is written to TASKS.yaml by the `add` command, and can be updated with `edit --plan`.
|
|
272
|
+
|
|
273
|
+
**Document types that can serve as plan** (choose one):
|
|
274
|
+
- Thread artifact — The `## Plan (iteration N)` or `## Materialization Summary` artifact produced by the two-stage review template (e.g., director/plan artifact)
|
|
275
|
+
- Project decision — `context/projects/<project>/decisions/DR-NNNN.md`
|
|
276
|
+
- Project roadmap / mission — `roadmap.md` / `mission.md` (for mission gap analysis / standing tasks)
|
|
277
|
+
- Experiment protocol — `context/projects/<project>/experiments/EXP-NNN.md` (when a task directly corresponds to an experiment)
|
|
278
|
+
- System-level decision — `context/decisions/DR-NNNN.md`
|
|
279
|
+
|
|
280
|
+
**Rules**:
|
|
281
|
+
- `--plan` path is **relative to repo root** (e.g., `context/projects/dex-hand/decisions/DR-0012.md`)
|
|
282
|
+
- **Tasks without a corresponding plan document must not be created**. If it is just a vague idea, first write a decision / short plan md, then create the task with that as `--plan`.
|
|
283
|
+
- Tasks generated by mission gap analysis use `mission.md` or `roadmap.md` as plan; standing tasks use this skill file or the project-level standing-tasks document as plan
|
|
284
|
+
|
|
285
|
+
**CLI loose constraint vs skill hard requirement**: The CLI `add` does not error when `--plan` is missing, but `task lint` will report a `missing-plan` warning, and **this skill's Task Creation path must provide it**.
|
|
286
|
+
|
|
287
|
+
### GPU Slot Scheduling
|
|
288
|
+
|
|
289
|
+
The `gpu` field specifies that a task needs to use GPU on a particular machine. The dispatcher schedules at **per-GPU slot** granularity:
|
|
290
|
+
|
|
291
|
+
- **Syntax**: `gpu: <machine>` (with `gpu-count` specifying the number of GPUs, default 1)
|
|
292
|
+
- The dispatcher detects free GPU slots via `nvidia-smi`, only dispatches when sufficient slots are free
|
|
293
|
+
- Automatically sets `CUDA_VISIBLE_DEVICES` during dispatch
|
|
294
|
+
- Corresponding GPU slot is released after task completion
|
|
295
|
+
|
|
296
|
+
### Task Decomposition
|
|
297
|
+
|
|
298
|
+
#### Iron Rule 1: One-Criterion-One-Task
|
|
299
|
+
|
|
300
|
+
**Each independently completable/verifiable condition in the Done when must be a separate task.**
|
|
301
|
+
|
|
302
|
+
Judgment criteria: After condition A is completed, even if condition B has not started, is the result of A already usable? If yes, it must be split.
|
|
303
|
+
|
|
304
|
+
**Anti-pattern: Checklist-in-Task** — Do not use numbered sub-conditions (1)(2)(3)... to pack multiple independent work items into a single "Done when".
|
|
305
|
+
|
|
306
|
+
**Exception 1 — Atomic verification**: Multiple sub-conditions are different verification dimensions of the same atomic operation (e.g., "script runs without errors + output file exists + metrics within reasonable range").
|
|
307
|
+
|
|
308
|
+
**Exception 2 — Article writing**: Long-form writing tasks such as papers are not split by section; execute as a single task to ensure cross-section coherence.
|
|
309
|
+
|
|
310
|
+
**Example**:
|
|
311
|
+
|
|
312
|
+
```yaml
|
|
313
|
+
# ❌ 3 independent experiments + analysis packed into 1 task
|
|
314
|
+
- id: x001
|
|
315
|
+
text: "Run missing baseline experiments"
|
|
316
|
+
done-when: "(1) BC baseline done (2) DG/DANN/CORAL done (3) vision encoder comparison done (4) result analysis done"
|
|
317
|
+
|
|
318
|
+
# ✅ Split into 3 experiments + 1 analysis task (all referencing the same experiment protocol as plan)
|
|
319
|
+
- id: a001
|
|
320
|
+
text: "Run BC baseline experiment"
|
|
321
|
+
plan: context/projects/dex-hand/experiments/EXP-017.md
|
|
322
|
+
done-when: "Training completed, results saved to results/"
|
|
323
|
+
|
|
324
|
+
- id: a002
|
|
325
|
+
text: "Run domain adaptation baseline"
|
|
326
|
+
plan: context/projects/dex-hand/experiments/EXP-017.md
|
|
327
|
+
done-when: "DG/DANN/CORAL training completed, results saved to results/"
|
|
328
|
+
|
|
329
|
+
- id: a003
|
|
330
|
+
text: "Run vision encoder comparison experiment"
|
|
331
|
+
plan: context/projects/dex-hand/experiments/EXP-017.md
|
|
332
|
+
done-when: "Comparison experiment completed, results saved to results/"
|
|
333
|
+
|
|
334
|
+
- id: a004
|
|
335
|
+
text: "Analyze baseline experiment results"
|
|
336
|
+
plan: context/projects/dex-hand/experiments/EXP-017.md
|
|
337
|
+
depends-on: [a001, a002, a003]
|
|
338
|
+
done-when: "Three sets of experiment results compared and analyzed, conclusions recorded in experiments/EXP-NNN.md"
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
#### Iron Rule 2: Explicit Dependency Declaration
|
|
342
|
+
|
|
343
|
+
If decomposed tasks have execution order requirements, they **must use `depends-on` or `blocked-by` to explicitly declare** them. Do not rely on implicit list order.
|
|
344
|
+
|
|
345
|
+
```yaml
|
|
346
|
+
# ✅ Explicitly orchestrated with depends-on
|
|
347
|
+
- id: d001
|
|
348
|
+
text: "Prepare training data"
|
|
349
|
+
plan: context/projects/dex-hand/decisions/DR-0008.md
|
|
350
|
+
done-when: "WebDataset shards generated"
|
|
351
|
+
|
|
352
|
+
- id: d002
|
|
353
|
+
text: "Train model"
|
|
354
|
+
plan: context/projects/dex-hand/experiments/EXP-018.md
|
|
355
|
+
depends-on: [d001]
|
|
356
|
+
done-when: "Training completed, checkpoint saved"
|
|
357
|
+
|
|
358
|
+
- id: d003
|
|
359
|
+
text: "Evaluate model"
|
|
360
|
+
plan: context/projects/dex-hand/experiments/EXP-018.md
|
|
361
|
+
depends-on: [d002]
|
|
362
|
+
done-when: "Eval metrics recorded in experiments/EXP-NNN.md"
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
#### Decomposition Trigger Conditions
|
|
366
|
+
|
|
367
|
+
- Done when contains multiple independently completable conditions (Iron Rule 1, highest priority)
|
|
368
|
+
- Decomposed subtasks have sequential dependencies but are not declared (Iron Rule 2)
|
|
369
|
+
- Has 2+ independent steps
|
|
370
|
+
- Involves 3+ files
|
|
371
|
+
- Mixes blocked and unblocked work
|
|
372
|
+
- Mixes mechanical work and judgment-based work
|
|
373
|
+
|
|
374
|
+
### Stage Boundary Constraints
|
|
375
|
+
|
|
376
|
+
**For projects using the stage-gate mechanism**: Each task creation operation only creates tasks **up to the next gate**; do not pre-create tasks across gates for future stages.
|
|
377
|
+
|
|
378
|
+
- When creating next-stage tasks, must end with a gate task: `GATE: Stage <N> <stage name>`, whose `--depends-on` references all task IDs in that stage
|
|
379
|
+
- Gate tasks form an execution barrier — no tasks for the next stage may be dispatched before passing through the gate for re-evaluation
|
|
380
|
+
- Pre-creating tasks across multiple stages **violates this constraint**: future stage tasks should be authorized by the next gate's verdict, not pre-judged by the current creator
|
|
381
|
+
|
|
382
|
+
**Exceptions**:
|
|
383
|
+
- **Iterate branch** patch tasks use the new iter gate as cutoff point (`GATE: Stage <N> (iter <k>) <stage name>`)
|
|
384
|
+
- **Mission gap analysis** / **standing tasks** are allowed to create maintenance tasks not belonging to a specific stage (e.g., STATUS.md update, cross-reference verification)
|
|
385
|
+
- Projects not using stage-gate are not subject to this constraint
|
|
386
|
+
|
|
387
|
+
### Mission Gap Analysis (Empty Queue Fallback)
|
|
388
|
+
|
|
389
|
+
When there are no executable tasks, do not invent work. Execute mission gap analysis:
|
|
390
|
+
1. Read the project mission.md success conditions
|
|
391
|
+
2. Read the project roadmap.md milestone verification conditions
|
|
392
|
+
3. Compare against existing TASKS.md task coverage
|
|
393
|
+
4. Auto-generate tasks for uncovered conditions
|
|
394
|
+
5. If no gap → nothing to do, record and end
|
|
395
|
+
|
|
396
|
+
### Task Supply Health
|
|
397
|
+
|
|
398
|
+
Task supply health indicators:
|
|
399
|
+
- Each active project has at least 2 actionable tasks
|
|
400
|
+
- Total actionable tasks >= 5
|
|
401
|
+
- No more than 50% of tasks are blocked
|
|
402
|
+
|
|
403
|
+
Auto-generation strategy when supply is low:
|
|
404
|
+
1. Mission gap analysis (from mission → task)
|
|
405
|
+
2. Roadmap-driven decomposition (split from roadmap milestones)
|
|
406
|
+
3. Experiment follow-up (generate follow-up tasks from experiment conclusions)
|
|
407
|
+
4. Standing tasks (periodic maintenance tasks)
|
|
408
|
+
|
|
409
|
+
### Standing Tasks (Recyclable)
|
|
410
|
+
|
|
411
|
+
The following template tasks can be auto-created when supply is low:
|
|
412
|
+
|
|
413
|
+
```yaml
|
|
414
|
+
- text: "Update STATUS.md for {project}"
|
|
415
|
+
why: "Keep project status current"
|
|
416
|
+
done-when: "STATUS.md reflects actual machine state and latest experiment results"
|
|
417
|
+
priority: low
|
|
418
|
+
plan: context/projects/{project}/mission.md
|
|
419
|
+
|
|
420
|
+
- text: "Verify cross-references in {project}"
|
|
421
|
+
why: "Prevent documentation drift"
|
|
422
|
+
done-when: "All file references in project files point to existing paths"
|
|
423
|
+
priority: low
|
|
424
|
+
plan: context/projects/{project}/mission.md
|
|
425
|
+
```
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: approval
|
|
3
|
+
description: "Use when the user wants to review, approve, or reject queued operations"
|
|
4
|
+
author: Cortex
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
allowed-tools:
|
|
7
|
+
- Read
|
|
8
|
+
- Write
|
|
9
|
+
- Edit
|
|
10
|
+
- Bash
|
|
11
|
+
- Grep
|
|
12
|
+
date: 2026-02-28
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Approval
|
|
16
|
+
|
|
17
|
+
You are Cortex, presenting pending operations for user approval.
|
|
18
|
+
|
|
19
|
+
This is the approval queue interface. Show the user what's waiting for their sign-off, and execute approved operations.
|
|
20
|
+
|
|
21
|
+
## Arguments
|
|
22
|
+
$ARGUMENTS
|
|
23
|
+
|
|
24
|
+
If the user provides an argument like "approve all", "approve 1", or "reject 2", handle it directly. If no argument, show the current queue.
|
|
25
|
+
|
|
26
|
+
## Step 1: Read the Queue
|
|
27
|
+
|
|
28
|
+
Read `context/PENDING_APPROVALS.md`. If the file doesn't exist or is empty, output:
|
|
29
|
+
```
|
|
30
|
+
No pending approvals.
|
|
31
|
+
```
|
|
32
|
+
And stop.
|
|
33
|
+
|
|
34
|
+
## Step 2: Present Pending Items
|
|
35
|
+
|
|
36
|
+
Filter for entries with `Status: pending`. Output:
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
Pending Approvals
|
|
40
|
+
|
|
41
|
+
1. [operation summary]
|
|
42
|
+
Reason: [why]
|
|
43
|
+
Impact: [what it affects]
|
|
44
|
+
Command: [what will run]
|
|
45
|
+
Queued: [timestamp]
|
|
46
|
+
|
|
47
|
+
2. ...
|
|
48
|
+
|
|
49
|
+
Reply:
|
|
50
|
+
• "approve 1" / "approve all" — execute
|
|
51
|
+
• "reject 2" — remove from queue
|
|
52
|
+
• "approve 1 3" — approve specific items
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Number each item sequentially for easy reference.
|
|
56
|
+
|
|
57
|
+
## Step 3: Process User Response
|
|
58
|
+
|
|
59
|
+
When the user responds with approval/rejection:
|
|
60
|
+
|
|
61
|
+
**Approve:**
|
|
62
|
+
- Execute the approved operation(s)
|
|
63
|
+
- Update the entry in PENDING_APPROVALS.md: change `Status: pending` → `Status: approved — executed [timestamp]`
|
|
64
|
+
- Report the result in the output
|
|
65
|
+
- Follow close-the-loop: verify the operation succeeded, record outcome
|
|
66
|
+
|
|
67
|
+
**Reject:**
|
|
68
|
+
- Update the entry: change `Status: pending` → `Status: rejected [timestamp]`
|
|
69
|
+
- Acknowledge in the output
|
|
70
|
+
- Do not execute
|
|
71
|
+
|
|
72
|
+
**Approve with modification:**
|
|
73
|
+
- If the user says something like "approve 1 but change X to Y", apply the modification and execute
|
|
74
|
+
- Record what was changed in the approval entry
|
|
75
|
+
|
|
76
|
+
## Step 4: Cleanup
|
|
77
|
+
|
|
78
|
+
If all entries in PENDING_APPROVALS.md are resolved (no `Status: pending` remaining), the file stays as a historical log. Old resolved entries can be cleaned up periodically during `/evolve`.
|
|
79
|
+
|
|
80
|
+
## Principles
|
|
81
|
+
- Present enough context for the user to decide quickly — no back-and-forth needed
|
|
82
|
+
- Execute approved operations immediately and report results
|
|
83
|
+
- Rejected operations are recorded, not deleted — they serve as decision history
|
|
84
|
+
- If an approved operation fails during execution, report the failure clearly and keep the entry as `Status: failed — [reason]`
|