@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,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "context/projects/*/experiments/**"
|
|
4
|
+
- "context/projects/*/knowledge/**"
|
|
5
|
+
- "context/projects/*/patterns/**"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Atomic Memory File Format Specification (DR-0007)
|
|
9
|
+
|
|
10
|
+
Experiment, knowledge, and pattern entries have been migrated from a single monolithic file to an atomic structure with one file per entry.
|
|
11
|
+
|
|
12
|
+
## Directory Structure
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
context/projects/<project>/
|
|
16
|
+
experiments/
|
|
17
|
+
index.md # Auto-generated (memory-index-regen), do not manually edit
|
|
18
|
+
EXP-001.md ~ EXP-NNN.md
|
|
19
|
+
knowledge/
|
|
20
|
+
index.md # Auto-generated
|
|
21
|
+
K-001.md ~ K-NNN.md
|
|
22
|
+
patterns/
|
|
23
|
+
index.md # Auto-generated
|
|
24
|
+
PAT-001.md ~ PAT-NNN.md
|
|
25
|
+
_meta/
|
|
26
|
+
access-log.jsonl # Hook auto-tracked Read/Grep access records
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Atomic File Format
|
|
30
|
+
|
|
31
|
+
Each file consists of YAML frontmatter + body content.
|
|
32
|
+
|
|
33
|
+
### Experiment File (EXP-NNN.md)
|
|
34
|
+
|
|
35
|
+
```markdown
|
|
36
|
+
---
|
|
37
|
+
id: EXP-042
|
|
38
|
+
date: 2026-03-23
|
|
39
|
+
project: <project-name>
|
|
40
|
+
summary: "Variant B reduces p99 latency 28% — new project best"
|
|
41
|
+
tags: [latency, optimization, variant-b, phase2]
|
|
42
|
+
status: valid
|
|
43
|
+
executor: "Cortex"
|
|
44
|
+
links: []
|
|
45
|
+
refs: 0
|
|
46
|
+
last-ref: null
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
### EXP-042: Variant B Latency Sweep
|
|
50
|
+
|
|
51
|
+
#### Background
|
|
52
|
+
<Why this experiment was done>
|
|
53
|
+
|
|
54
|
+
#### Goal
|
|
55
|
+
<What to verify>
|
|
56
|
+
|
|
57
|
+
#### Run Command (optional)
|
|
58
|
+
<The actual executed command>
|
|
59
|
+
|
|
60
|
+
#### Results
|
|
61
|
+
<Objective data and observations>
|
|
62
|
+
|
|
63
|
+
#### Conclusion
|
|
64
|
+
<Judgment based on results>
|
|
65
|
+
|
|
66
|
+
#### Reflection
|
|
67
|
+
- **Relationship to existing knowledge**: ...
|
|
68
|
+
- **New knowledge**: ...
|
|
69
|
+
- **Process defects**: ...
|
|
70
|
+
- **Suggested follow-up**: ...
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Knowledge File (K-NNN.md)
|
|
74
|
+
|
|
75
|
+
```markdown
|
|
76
|
+
---
|
|
77
|
+
id: K-005
|
|
78
|
+
date: 2026-03-15
|
|
79
|
+
project: <project-name>
|
|
80
|
+
summary: "Connection pool size 32 is the optimal range under our peak load"
|
|
81
|
+
tags: [pool-size, performance]
|
|
82
|
+
evidence: [EXP-022, EXP-037, EXP-041, EXP-042]
|
|
83
|
+
refs: 3
|
|
84
|
+
last-ref: 2026-03-23
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## K-005: Connection Pool Size Optimal Range
|
|
88
|
+
|
|
89
|
+
<Knowledge entry body content>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Anti-pattern type knowledge entries have summaries prefixed with `ANTI-PATTERN:`, and tags containing `anti-pattern`.
|
|
93
|
+
|
|
94
|
+
### Pattern File (PAT-NNN.md)
|
|
95
|
+
|
|
96
|
+
Cross-experiment patterns distilled from multiple experiments. Must include `source-experiments` and `evidence` fields for traceability.
|
|
97
|
+
|
|
98
|
+
```markdown
|
|
99
|
+
---
|
|
100
|
+
id: PAT-001
|
|
101
|
+
date: 2026-03-29
|
|
102
|
+
project: <project-name>
|
|
103
|
+
summary: "Tasks with high I/O concurrency consistently benefit from a connection-pool warm-up step"
|
|
104
|
+
tags: [pool-size, warm-up, performance]
|
|
105
|
+
source-experiments: [EXP-031, EXP-035, EXP-038]
|
|
106
|
+
evidence: [EXP-031, EXP-035, EXP-038]
|
|
107
|
+
refs: 0
|
|
108
|
+
last-ref: null
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## PAT-001: <Title>
|
|
112
|
+
|
|
113
|
+
### Observation / Evidence / Pattern Statement / Scope & Limitations / Implications
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
## Knowledge State Machine (Knowledge Lifecycle)
|
|
117
|
+
|
|
118
|
+
All entries share a unified `status` state:
|
|
119
|
+
|
|
120
|
+
| Status | Meaning | In index.md |
|
|
121
|
+
|--------|---------|-------------|
|
|
122
|
+
| `active` / `valid` / `partial` / empty | Normal, valid | Active table |
|
|
123
|
+
| `challenged:EXP-XXX` | Questioned by new experiment, pending review | Active table (annotated) |
|
|
124
|
+
| `corrected:EXP-XXX` | Conclusion has been corrected | Active table |
|
|
125
|
+
| `superseded:EXP-XXX` | Replaced by a better version | Superseded table |
|
|
126
|
+
| `refined:EXP-XXX` | Fully replaced by an improved version | Superseded table |
|
|
127
|
+
| `invalidated:EXP-XXX` | **Has been falsified** | Invalidated table (warning) |
|
|
128
|
+
| `stale` | No references for a long time, pending review | Superseded table |
|
|
129
|
+
|
|
130
|
+
`invalidated` entries are replaced with a tombstone (retain frontmatter, replace body with a warning) to prevent subsequent sessions from using incorrect knowledge.
|
|
131
|
+
|
|
132
|
+
## Frontmatter Field Descriptions
|
|
133
|
+
|
|
134
|
+
| Field | Required | Description |
|
|
135
|
+
|-------|----------|-------------|
|
|
136
|
+
| `id` | ✅ | Unique identifier: EXP-NNN / K-NNN / PAT-NNN |
|
|
137
|
+
| `date` | ✅ | Creation date YYYY-MM-DD |
|
|
138
|
+
| `project` | ✅ | Project name |
|
|
139
|
+
| `summary` | ✅ | One-line summary (for index.md table) |
|
|
140
|
+
| `tags` | ✅ | Tags array |
|
|
141
|
+
| `status` | Recommended | See the state machine table above |
|
|
142
|
+
| `executor` | Optional for experiments | Executor |
|
|
143
|
+
| `links` | Optional | Related entry IDs |
|
|
144
|
+
| `evidence` | Recommended for K/PAT | List of experiment IDs supporting this conclusion (traceability) |
|
|
145
|
+
| `source-experiments` | Required for PAT | Source experiments that this pattern was derived from |
|
|
146
|
+
| `refs` | Auto | Reference count (computed by memory-index-regen) |
|
|
147
|
+
| `last-ref` | Auto | Last reference time |
|
|
148
|
+
| `invalidated-date` | Auto | Date of falsification (invalidated entries only) |
|
|
149
|
+
| `invalidated-reason` | Auto | Reason for falsification (invalidated entries only) |
|
|
150
|
+
|
|
151
|
+
## New Experiment Workflow
|
|
152
|
+
|
|
153
|
+
1. Determine the next EXP number (check the maximum number in the experiments/ directory +1)
|
|
154
|
+
2. Create `experiments/EXP-NNN.md`, write frontmatter + body
|
|
155
|
+
3. Check if old experiment conclusions are overthrown/corrected, if so:
|
|
156
|
+
- Update the old experiment file's `status` field (`superseded:EXP-XXX` or `refined:EXP-XXX`)
|
|
157
|
+
- Append `#### Downstream Impact` analysis at the end of the new experiment
|
|
158
|
+
- Check if the overturned experiment is referenced by K/PAT entries (grep `evidence` field), if so mark as `challenged`
|
|
159
|
+
4. **No need to manually update index.md** — the index is automatically rebuilt by `memory-index-regen.ts`
|
|
160
|
+
|
|
161
|
+
## New Knowledge/Pattern Workflow
|
|
162
|
+
|
|
163
|
+
1. Determine the next K/PAT number
|
|
164
|
+
2. Create the file, **must include `evidence` field** listing supporting experiments
|
|
165
|
+
3. If the content is derived from multiple experiments, ensure `source-experiments` is filled in
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "context/projects/*/ISSUES.md"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# ISSUES.md Convention
|
|
7
|
+
|
|
8
|
+
Records execution friction affecting work efficiency: misleading requirements, confusing documentation, tools that are hard to use, incorrect parameters, process deadlocks, etc. For centralized fixing in subsequent sessions.
|
|
9
|
+
|
|
10
|
+
## Hard Constraints
|
|
11
|
+
|
|
12
|
+
- **Length limit: 80 lines**. Exceeding means unresolved issues are accumulating, triggering cleanup.
|
|
13
|
+
- **Append mode**: New issues are appended to the end.
|
|
14
|
+
- **Resolved entries are deleted directly**: No archiving, no history retained. Delete the corresponding entry from the file immediately after fixing.
|
|
15
|
+
|
|
16
|
+
## Entry Format
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
- **<One-line title>** (<YYYY-MM-DD>)
|
|
20
|
+
- Problem: <What specific friction/error/confusion point>
|
|
21
|
+
- Context: <Which task/operation/context was encountered in>
|
|
22
|
+
- Investigation: <What was checked, what was tried, root cause guess or confirmation>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Prohibited Content
|
|
26
|
+
|
|
27
|
+
- Fixed issues (resolved must be deleted, no changelog left behind)
|
|
28
|
+
- Experiment failure conclusions → belongs in `experiments/EXP-NNN.md`
|
|
29
|
+
- Design decision trade-offs → belongs in `decisions/DR-NNNN.md`
|
|
30
|
+
- Project-level blockers → belongs in `STATUS.md` "Unresolved Issues" section (ISSUES.md records process friction, not phase blockers)
|
|
31
|
+
|
|
32
|
+
## Overflow Handling
|
|
33
|
+
|
|
34
|
+
If exceeding 80 lines before writing:
|
|
35
|
+
1. Check for entries that were silently fixed but not deleted → delete them
|
|
36
|
+
2. Merge similar friction into one entry
|
|
37
|
+
3. Still exceeded → leave a pointer in STATUS.md "Unresolved Issues" section, clear and restart ISSUES.md entirely
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "context/**"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Context Meta-Rules
|
|
7
|
+
|
|
8
|
+
Cross-file conventions. See the dedicated rule for each file type in the same directory (status-md.md / issues-md.md / mission-md.md / roadmap-md.md / overview-md.md / task-system.md / experiment-format.md / decision-records.md).
|
|
9
|
+
|
|
10
|
+
## General Rules
|
|
11
|
+
|
|
12
|
+
- **All context updates are auto-committed via git**: Incremental commits, each logical unit (experiment configuration, analysis report, status update) is committed upon completion, do not accumulate until the end of the session.
|
|
13
|
+
- **Value traceability**: Every value appearing in STATUS / EXP / K / reports must be traceable — specify the script + data file that produced it, or write inline arithmetic citing the data. Numbers without sources are invalid.
|
|
14
|
+
- **Update index after creating new files**: After creating a new file in any directory, update that directory's CORTEX.md index.
|
|
15
|
+
- **Decision traceability**: Each DR-NNNN within a project adds an inline reference in the project's CORTEX.md; system-level DRs are referenced in `context/CORTEX.md`.
|
|
16
|
+
|
|
17
|
+
## Index Files
|
|
18
|
+
|
|
19
|
+
`experiments/index.md`, `knowledge/index.md`, `patterns/index.md` are auto-generated by `memory-index-regen.ts` from frontmatter. **Do not manually edit**. Rebuild:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
cd agent-server && node --import tsx src/memory-index-regen.ts --all
|
|
23
|
+
cd agent-server && node --import tsx src/memory-index-regen.ts <project>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Hook Auto-Tracking
|
|
27
|
+
|
|
28
|
+
PostToolUse hook automatically records Read/Grep access to atomic files (EXP/K/PAT) in `_meta/access-log.jsonl`, computing refs and last-ref during index rebuild.
|
|
29
|
+
|
|
30
|
+
## File Type Quick Reference
|
|
31
|
+
|
|
32
|
+
| File | Dedicated rule | Update mode |
|
|
33
|
+
|------|----------------|-------------|
|
|
34
|
+
| `STATUS.md` | status-md.md | Overwrite, hard limit 120 lines |
|
|
35
|
+
| `ISSUES.md` | issues-md.md | Append, resolved entries deleted directly, hard limit 80 lines |
|
|
36
|
+
| `mission.md` | mission-md.md | Modify after user confirmation |
|
|
37
|
+
| `roadmap.md` | roadmap-md.md | Stable, milestones must contain testable checklist |
|
|
38
|
+
| `OVERVIEW.md` | overview-md.md | Synchronous update, hard limit 60 lines |
|
|
39
|
+
| `TASKS.yaml` | task-system.md | Read/write via cortex-task CLI, do not manually edit |
|
|
40
|
+
| `experiments/EXP-NNN.md` | experiment-format.md | Atomic file + frontmatter |
|
|
41
|
+
| `knowledge/K-NNN.md` | experiment-format.md | Atomic file + evidence field |
|
|
42
|
+
| `patterns/PAT-NNN.md` | experiment-format.md | Atomic file + source-experiments |
|
|
43
|
+
| `decisions/DR-NNNN.md` | decision-records.md | Append, keep old file when superseded |
|
|
44
|
+
| `_meta/access-log.jsonl` | — | Auto-written by hook |
|
|
45
|
+
| `*/index.md` | — | Auto-generated by memory-index-regen |
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "context/projects/*/mission.md"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# mission.md Convention
|
|
7
|
+
|
|
8
|
+
The project's "constitution": defines goals and success conditions. It is the basis for Cortex's autonomous work decisions.
|
|
9
|
+
|
|
10
|
+
## Hard Constraints
|
|
11
|
+
|
|
12
|
+
- **Stable file**: Can only be modified after user confirmation. Cortex must not rewrite or expand scope on its own.
|
|
13
|
+
- **Modification trigger condition**: User explicitly directs reorient / pivot / scope change. Do not touch in any other case.
|
|
14
|
+
- **Length suggestion**: 50-100 lines. Too long means content that belongs in roadmap/STATUS has been mixed in.
|
|
15
|
+
|
|
16
|
+
## Required Sections
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
# <project> Mission
|
|
20
|
+
|
|
21
|
+
## Goal
|
|
22
|
+
<1-3 paragraphs. What problem this project solves, what deliverables it produces. Include deadline-type information (if applicable)>
|
|
23
|
+
|
|
24
|
+
## Success Conditions
|
|
25
|
+
<Verifiable criteria. Bullet list. Each must be objectively determinable>
|
|
26
|
+
- [ ] <Condition 1>
|
|
27
|
+
- [ ] <Condition 2>
|
|
28
|
+
|
|
29
|
+
## Scope Boundaries
|
|
30
|
+
<Clearly state what is and is not done. Prevent scope creep>
|
|
31
|
+
- Includes: ...
|
|
32
|
+
- Does not include: ...
|
|
33
|
+
|
|
34
|
+
## Resource Constraints (optional)
|
|
35
|
+
<Budget, deadline, personnel, compute resources, etc. hard constraints>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Prohibited Content
|
|
39
|
+
|
|
40
|
+
- Current progress/phase → belongs in `STATUS.md`
|
|
41
|
+
- Roadmap and milestones → belongs in `roadmap.md`
|
|
42
|
+
- Task list → belongs in `TASKS.yaml`
|
|
43
|
+
- Experiment data → belongs in `experiments/`
|
|
44
|
+
|
|
45
|
+
## Modification Process
|
|
46
|
+
|
|
47
|
+
For major reorient-type changes: first use the `reorient` skill to jointly update STATUS / roadmap / project CORTEX.md to avoid context inconsistency.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "context/OVERVIEW.md"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# OVERVIEW.md Convention
|
|
7
|
+
|
|
8
|
+
Cross-project global view: one-line status per project + current focus. Primary input for `/orient`.
|
|
9
|
+
|
|
10
|
+
## Hard Constraints
|
|
11
|
+
|
|
12
|
+
- **Synchronous update**: Immediately synchronize after project status changes (phase advancement, pause, archiving).
|
|
13
|
+
- **Length limit: 60 lines**. Exceeding means too many projects or descriptions are too long — compress one-line descriptions, or archive completed projects to the appendix.
|
|
14
|
+
- **One line per project**: Project-level details belong in `projects/<name>/STATUS.md`, OVERVIEW only contains index-level summaries.
|
|
15
|
+
|
|
16
|
+
## Required Structure
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
# Overview
|
|
20
|
+
|
|
21
|
+
| Project | Status | Priority | Last Activity |
|
|
22
|
+
|---------|--------|----------|---------------|
|
|
23
|
+
| <name> | **<phase title>** — <one-line current status> | High/Medium/Low | YYYY-MM-DD |
|
|
24
|
+
...
|
|
25
|
+
|
|
26
|
+
## Current Focus
|
|
27
|
+
<One paragraph + numbered list, listing current priority projects and reasons>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## One-line Status Writing Guide
|
|
31
|
+
|
|
32
|
+
- Must include: Current phase title (**bold**)
|
|
33
|
+
- Must include: One-line current status (blocked on what / doing what / next step)
|
|
34
|
+
- Must not include: Experiment details, numerical results (→ EXP-NNN), decision reasoning (→ DR)
|
|
35
|
+
|
|
36
|
+
## Prohibited Content
|
|
37
|
+
|
|
38
|
+
- Project task list → belongs in `projects/<name>/TASKS.yaml`
|
|
39
|
+
- Project current phase details → belongs in `projects/<name>/STATUS.md`
|
|
40
|
+
- Experiment/knowledge entries → belongs in `projects/<name>/experiments|knowledge/`
|
|
41
|
+
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "context/projects/*/roadmap.md"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# roadmap.md Convention
|
|
7
|
+
|
|
8
|
+
Project roadmap and milestones. The machine uses this to determine phase progression and completion status.
|
|
9
|
+
|
|
10
|
+
## Hard Constraints
|
|
11
|
+
|
|
12
|
+
- **Stable file**: Milestone structure changes should be triggered by reorient/decision.
|
|
13
|
+
- **Each milestone must contain testable verification conditions** (checklist format). A milestone without a checklist is invalid.
|
|
14
|
+
- Completed milestones are retained with check marks, not deleted (for reviewing roadmap history).
|
|
15
|
+
- Length suggestion: ≤ 250 lines. If exceeded, consider splitting sub-projects or archiving completed phases.
|
|
16
|
+
|
|
17
|
+
## Required Structure
|
|
18
|
+
|
|
19
|
+
```markdown
|
|
20
|
+
# <project> Roadmap
|
|
21
|
+
|
|
22
|
+
## Phase 1: <Name>
|
|
23
|
+
Status: ✅ Complete / 🔄 In Progress / ⏳ Pending
|
|
24
|
+
Goal: <What this phase aims to achieve>
|
|
25
|
+
|
|
26
|
+
Verification Conditions:
|
|
27
|
+
- [x] <Verifiable condition 1>
|
|
28
|
+
- [x] <Verifiable condition 2>
|
|
29
|
+
|
|
30
|
+
Outputs:
|
|
31
|
+
- EXP-NNN, K-NNN, ... (pointing to settled atomic files)
|
|
32
|
+
|
|
33
|
+
## Phase 2: <Name>
|
|
34
|
+
...
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Verification Condition Writing Guidelines
|
|
38
|
+
|
|
39
|
+
Each checklist item must be **machine-determinable** or **objectively verifiable by another agent**.
|
|
40
|
+
|
|
41
|
+
Compliant:
|
|
42
|
+
- `[ ] End-to-end demo passes on staging (verified by EXP-NNN)`
|
|
43
|
+
- `[ ] PR #123 merged`
|
|
44
|
+
- `[ ] knowledge/K-012 created and referenced ≥ 1 time`
|
|
45
|
+
|
|
46
|
+
Non-compliant:
|
|
47
|
+
- `[ ] System performs well` (not determinable)
|
|
48
|
+
- `[ ] Verification completed` (missing completion conditions)
|
|
49
|
+
- `[ ] Improve performance` (no target value)
|
|
50
|
+
|
|
51
|
+
## Prohibited Content
|
|
52
|
+
|
|
53
|
+
- Current status → belongs in `STATUS.md`
|
|
54
|
+
- Task list → belongs in `TASKS.yaml` (roadmap is milestone-level, not task-level)
|
|
55
|
+
- Experiment details → belongs in `experiments/`
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "context/projects/*/STATUS.md"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# STATUS.md Convention
|
|
7
|
+
|
|
8
|
+
Snapshot of the project's current state. **Overwrite mode** — only keep the latest state, do not accumulate history.
|
|
9
|
+
|
|
10
|
+
## Hard Constraints
|
|
11
|
+
|
|
12
|
+
- **Length limit: 120 lines**. Must trim if exceeded.
|
|
13
|
+
- **Update mode: Overwrite**. Update after each related operation. Do not append historical records.
|
|
14
|
+
- **Check line count before each write**: >=80 lines warning, >=120 lines forced trimming.
|
|
15
|
+
|
|
16
|
+
## Required Sections (in order)
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
# <project> Status
|
|
20
|
+
|
|
21
|
+
Updated: YYYY-MM-DD
|
|
22
|
+
|
|
23
|
+
## Current Phase
|
|
24
|
+
<One paragraph, stating the current stage and core focus>
|
|
25
|
+
|
|
26
|
+
## Recent Progress
|
|
27
|
+
<One paragraph or 3-5 bullet points, only changes within this phase>
|
|
28
|
+
|
|
29
|
+
## Unresolved Issues
|
|
30
|
+
<Bullet list, open issues / blockers / pending decisions; write "none" if none>
|
|
31
|
+
|
|
32
|
+
## Next Steps
|
|
33
|
+
<Clear next action. Points to task-id in TASKS.yaml or a specific plan file>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Prohibited Content
|
|
37
|
+
|
|
38
|
+
- Historical records of completed items → belongs in `tasks-archive.md`
|
|
39
|
+
- Experiment data/conclusions → belongs in `experiments/EXP-NNN.md`
|
|
40
|
+
- Settled knowledge/methodology → belongs in `knowledge/K-NNN.md`
|
|
41
|
+
- Design decision trade-offs → belongs in `decisions/DR-NNNN.md`
|
|
42
|
+
- Superseded old phase descriptions → delete directly (old phase outputs should have been settled into EXP/K/PAT)
|
|
43
|
+
|
|
44
|
+
## Overflow Handling
|
|
45
|
+
|
|
46
|
+
If exceeding 120 lines before writing:
|
|
47
|
+
1. Move entries from "Recent Progress" that span across current phase out (→ EXP/K or delete directly)
|
|
48
|
+
2. Delete "Completed Items" paragraph (if any)
|
|
49
|
+
3. Still exceeded → delete the entire old phase paragraph, keep only a one-line index pointing to the archive
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
paths:
|
|
3
|
+
- "context/projects/*/TASKS.yaml"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Task System — Executing Agent Guide
|
|
7
|
+
|
|
8
|
+
You are reading a TASKS.yaml file. This is a structured task queue, and you have been dispatched to execute specific tasks within it.
|
|
9
|
+
|
|
10
|
+
## TASKS.yaml Format
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
tasks:
|
|
14
|
+
- id: c8a2
|
|
15
|
+
text: "Task description starting with a verb"
|
|
16
|
+
why: "Why this task needs to be done"
|
|
17
|
+
done-when: "Verifiable completion condition"
|
|
18
|
+
priority: medium # high | medium | low
|
|
19
|
+
status: open # open | done
|
|
20
|
+
template: <thread-template-name>
|
|
21
|
+
plan: path/to/design-doc.md
|
|
22
|
+
# Optional fields (defaults apply when omitted)
|
|
23
|
+
depends-on: [a1b2]
|
|
24
|
+
gpu: <machine-name> # optional: target machine for GPU tasks
|
|
25
|
+
blocked-by: "Blocking reason"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Status Update
|
|
29
|
+
|
|
30
|
+
Use the single CLI `cortex-task` to update task status, **do not manually edit TASKS.yaml**:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Claim task
|
|
34
|
+
cortex-task claim --project <project> --task-id <id>
|
|
35
|
+
# Complete task
|
|
36
|
+
cortex-task complete --project <project> --task-id <id> --note "Completion note"
|
|
37
|
+
# Mark blocked
|
|
38
|
+
cortex-task block --project <project> --task-id <id> --reason "Blocking reason"
|
|
39
|
+
# Unblock
|
|
40
|
+
cortex-task unblock --project <project> --task-id <id>
|
|
41
|
+
# Query
|
|
42
|
+
cortex-task query --project <project> --status actionable --json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Run `cortex-task --help` for the full list of commands and parameters.
|
|
46
|
+
|
|
47
|
+
## Partial Completion
|
|
48
|
+
|
|
49
|
+
Never set status to done + "(partial)". If work is only partially completed:
|
|
50
|
+
- Keep status: open and update the description to reflect remaining work
|
|
51
|
+
- Or split into completed subtask + new open task
|
|
52
|
+
|
|
53
|
+
status: done is a terminal state — the task selector treats it as completed and never revisits it.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Backend } from './types.js';
|
|
2
|
+
export declare enum Capability {
|
|
3
|
+
Hooks = "hooks",
|
|
4
|
+
Plugins = "plugins",
|
|
5
|
+
MCP = "mcp",
|
|
6
|
+
PlanMode = "plan-mode",
|
|
7
|
+
AskUserQuestion = "ask-user-question",
|
|
8
|
+
SystemPromptOverride = "system-prompt-override",
|
|
9
|
+
SessionResume = "session-resume",
|
|
10
|
+
ToolAllowlist = "tool-allowlist"
|
|
11
|
+
}
|
|
12
|
+
export declare const CAPABILITIES_BY_BACKEND: Record<Backend, Set<Capability>>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// input: Backend type from types.ts
|
|
2
|
+
// output: Capability enum + CAPABILITIES_BY_BACKEND matrix
|
|
3
|
+
// pos: Capability declaration matrix per backend
|
|
4
|
+
// >>> If I am updated, update my header comment and the parent folder's CORTEX.md <<<
|
|
5
|
+
export var Capability;
|
|
6
|
+
(function (Capability) {
|
|
7
|
+
Capability["Hooks"] = "hooks";
|
|
8
|
+
Capability["Plugins"] = "plugins";
|
|
9
|
+
Capability["MCP"] = "mcp";
|
|
10
|
+
Capability["PlanMode"] = "plan-mode";
|
|
11
|
+
Capability["AskUserQuestion"] = "ask-user-question";
|
|
12
|
+
Capability["SystemPromptOverride"] = "system-prompt-override";
|
|
13
|
+
Capability["SessionResume"] = "session-resume";
|
|
14
|
+
Capability["ToolAllowlist"] = "tool-allowlist";
|
|
15
|
+
})(Capability || (Capability = {}));
|
|
16
|
+
// Claude: full native support (claude-bridge.ts currently wires all eight; DR-0008 §3.2)
|
|
17
|
+
const CLAUDE_CAPS = [
|
|
18
|
+
Capability.Hooks,
|
|
19
|
+
Capability.Plugins,
|
|
20
|
+
Capability.MCP,
|
|
21
|
+
Capability.PlanMode,
|
|
22
|
+
Capability.AskUserQuestion,
|
|
23
|
+
Capability.SystemPromptOverride,
|
|
24
|
+
Capability.SessionResume,
|
|
25
|
+
Capability.ToolAllowlist,
|
|
26
|
+
];
|
|
27
|
+
// Codex: per DR-0008 §3.4 table — MCP via existing buildMcpBlock in codex-bridge.ts; --system-prompt + resume via app-server RPC; no Hooks/Plugins/PlanMode/AskUserQuestion/ToolAllowlist
|
|
28
|
+
const CODEX_CAPS = [
|
|
29
|
+
Capability.MCP,
|
|
30
|
+
Capability.SystemPromptOverride,
|
|
31
|
+
Capability.SessionResume,
|
|
32
|
+
];
|
|
33
|
+
// PI: per DR-0008 §5.1 capability matrix — --skill for Plugins, --system-prompt for SystemPromptOverride, tool-allowlist via adapter;
|
|
34
|
+
// MCP enabled by mcp-bridge.ts extension (task 5754): auto-injected via --extension in PIAdapter.spawn();
|
|
35
|
+
// PlanMode/AskUserQuestion: implemented via tool-shims.ts pseudo-tools + extension_ui_response routing (Phase 2 §S3, 2026-04-27);
|
|
36
|
+
// SessionResume: S2 spike confirmed --session <path> resume works (DR-0008 §8 gate ticked, task 7ca9).
|
|
37
|
+
// Hooks via PI extension bridge per §3.5 — capability declared true because the extension is part of the default PI adapter package.
|
|
38
|
+
const PI_CAPS = [
|
|
39
|
+
Capability.Hooks,
|
|
40
|
+
Capability.Plugins,
|
|
41
|
+
Capability.MCP,
|
|
42
|
+
Capability.PlanMode,
|
|
43
|
+
Capability.AskUserQuestion,
|
|
44
|
+
Capability.SystemPromptOverride,
|
|
45
|
+
Capability.ToolAllowlist,
|
|
46
|
+
Capability.SessionResume,
|
|
47
|
+
];
|
|
48
|
+
export const CAPABILITIES_BY_BACKEND = {
|
|
49
|
+
claude: new Set(CLAUDE_CAPS),
|
|
50
|
+
codex: new Set(CODEX_CAPS),
|
|
51
|
+
pi: new Set(PI_CAPS),
|
|
52
|
+
};
|