@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,508 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug-campaign
|
|
3
|
+
description: "Use when debugging multi-round issues on pipelines, services, or complex systems, when a fix-test cycle has gone through 3+ iterations without convergence, or when encountering bugs that resist simple fixes"
|
|
4
|
+
author: Cortex
|
|
5
|
+
version: 2.0.0
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Debug Campaign Protocol
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
This skill governs **multi-round debugging campaigns** — situations where you're not fixing a single bug but systematically improving a complex system's reliability across multiple sessions. The key insight: in multi-component systems, bugs layer like an onion. Fixing one layer reveals the next. Planning for this upfront is what separates efficient campaigns from thrashing.
|
|
13
|
+
|
|
14
|
+
**Complements `superpowers:systematic-debugging`**: That skill handles single-bug root cause investigation (read error → reproduce → trace → fix). This skill handles the strategic layer: when to instrument, what to fix first, how to verify, and how to plan across multiple fix cycles.
|
|
15
|
+
|
|
16
|
+
**Evidence base**: This protocol is distilled from 50+ debugging experiments across flywheel (19 bugs, 37 experiments), dex-hand (rendering pipeline bugs), and cortex-self (meta-debugging). Every rule has at least 2 independent real-world failures backing it.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Part 1: Before You Start
|
|
21
|
+
|
|
22
|
+
### 1.1 Diagnostic Readiness (INSTRUMENT FIRST)
|
|
23
|
+
|
|
24
|
+
**Before fixing anything, ensure you can observe all failures.**
|
|
25
|
+
|
|
26
|
+
This is the single highest-leverage investment in a debugging campaign. Every hour spent here saves 3-5 hours of blind fix-test cycles later.
|
|
27
|
+
|
|
28
|
+
> *Evidence*: flywheel EXP-022→037 spent 7/16 experiments building diagnostics reactively (44% waste). Three independent logging bugs (B13/B16/B19) each blocked root cause identification until fixed. B16 fix revealed "VLA 100% failure was drop-platform check" — fundamentally changing the optimization direction.
|
|
29
|
+
|
|
30
|
+
#### Checklist
|
|
31
|
+
|
|
32
|
+
1. **Map all failure branches**
|
|
33
|
+
- `grep` all `except`, `if not`, `return error`, `raise`, `response.success == False` paths
|
|
34
|
+
- For each branch: does it produce a structured log entry or dump file?
|
|
35
|
+
- If not → add instrumentation BEFORE doing anything else
|
|
36
|
+
|
|
37
|
+
2. **Ensure dump coverage at every layer**
|
|
38
|
+
- **Service layer**: When an external call returns an error or empty response
|
|
39
|
+
- **Processing layer**: When parsing/transformation fails on a non-empty response
|
|
40
|
+
- **Orchestration layer**: When a stage marks items as failed
|
|
41
|
+
- Each dump must include: timestamp, unique ID (artifact/request/job), input context, raw response, failure category
|
|
42
|
+
|
|
43
|
+
3. **Verify call path symmetry**
|
|
44
|
+
- If a service has multiple call paths (e.g., `call()` vs `call_batch()`, sync vs async), verify each path has equivalent error handling and diagnostic coverage
|
|
45
|
+
- Asymmetric error handling is a systematic blind spot — one path silently swallows errors while another correctly reports them
|
|
46
|
+
|
|
47
|
+
4. **Check for diagnostic bug propagation**
|
|
48
|
+
- The same logging bug pattern often repeats across stages (flywheel B16 in vla_simulation → B19 same pattern in trajectory_filter)
|
|
49
|
+
- When you find a logging bug in one stage, `grep` for the same pattern in all other stages
|
|
50
|
+
|
|
51
|
+
5. **Log audit**
|
|
52
|
+
- For each stage, trace one failure path end-to-end through logs
|
|
53
|
+
- Can you answer: "which input caused this failure, what was the raw response, and what category of failure was it?"
|
|
54
|
+
- If you can't answer all three from logs alone → fix the logging first
|
|
55
|
+
|
|
56
|
+
#### Anti-pattern: "I'll add logging when I need it"
|
|
57
|
+
|
|
58
|
+
Every time you add logging reactively, you need another test cycle to collect the data. With N failure modes and M logging gaps, you burn N×M cycles instead of 1 upfront investment.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### 1.2 Failure Census (UNDERSTAND BEFORE FIXING)
|
|
63
|
+
|
|
64
|
+
**Before fixing anything, build a complete picture of what's failing and how often.**
|
|
65
|
+
|
|
66
|
+
> *Evidence*: flywheel EXP-028–030 spent 3 experiments fixing instantiation parse failures (11% of total), while type planning empty responses (67% of total) went unnoticed. EXP-031 Reflection: "Should have done a grep -c error frequency count first, would have located it in 30 seconds"
|
|
67
|
+
|
|
68
|
+
#### Steps
|
|
69
|
+
|
|
70
|
+
1. **Run the 5-minute error frequency check** on existing logs:
|
|
71
|
+
```bash
|
|
72
|
+
# Count distinct error types
|
|
73
|
+
grep -c "FAILED" pipeline.log
|
|
74
|
+
grep -oP 'reason=\K[^,]+' pipeline.log | sort | uniq -c | sort -rn
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
2. **Run the system once** with full diagnostics enabled (from 1.1)
|
|
78
|
+
|
|
79
|
+
3. **Categorize every failure** by:
|
|
80
|
+
- **Layer**: Which component/stage produced it?
|
|
81
|
+
- **Type**: What kind of failure? (empty response, parse error, timeout, logic error, etc.)
|
|
82
|
+
- **Frequency**: How many times did each type occur?
|
|
83
|
+
|
|
84
|
+
4. **Build a failure frequency table**:
|
|
85
|
+
```
|
|
86
|
+
| Failure Type | Layer | Count | % of Total | Impact |
|
|
87
|
+
|----------------------|----------|-------|------------|--------|
|
|
88
|
+
| Empty API response | Service | 12 | 67% | High |
|
|
89
|
+
| Think-only text | Parsing | 2 | 11% | Medium |
|
|
90
|
+
| Truncated JSON | Parsing | 1 | 6% | Low |
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
5. **Prioritize by frequency × impact**, not by which failure you noticed first
|
|
94
|
+
|
|
95
|
+
#### Anti-pattern: "Fix what I see first"
|
|
96
|
+
|
|
97
|
+
Your first observation is usually a symptom, not the highest-frequency root cause. The failure you notice first is the one with the most dramatic error message, not necessarily the most common one.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### 1.3 Campaign Plan
|
|
102
|
+
|
|
103
|
+
At the start of any multi-round debugging campaign, fill this out:
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
## Debug Campaign: [System Name]
|
|
107
|
+
|
|
108
|
+
**Target metric**: [e.g., prompt_generation ≥ 6/7]
|
|
109
|
+
**Current baseline**: [e.g., 5/7]
|
|
110
|
+
**Verification method**: [e.g., smoke test with --batch-size 14, run twice]
|
|
111
|
+
**Planned cycles**: 3-5 (expect onion layers)
|
|
112
|
+
|
|
113
|
+
### Phase 0 Status
|
|
114
|
+
- [ ] All failure branches have structured logging
|
|
115
|
+
- [ ] All call paths have symmetric error handling
|
|
116
|
+
- [ ] Dump files include: timestamp, ID, input context, raw response, failure category
|
|
117
|
+
- [ ] Can trace any single failure end-to-end from logs
|
|
118
|
+
- [ ] Checked for same logging bug pattern across all stages
|
|
119
|
+
|
|
120
|
+
### Failure Census (updated after each cycle)
|
|
121
|
+
| Failure Type | Layer | Count | % | Status |
|
|
122
|
+
|---|---|---|---|---|
|
|
123
|
+
| ... | ... | ... | ... | Open / Fixed / Accepted |
|
|
124
|
+
|
|
125
|
+
### Fix Cycle Log
|
|
126
|
+
| Cycle | Target Failure | Hypothesis Type | Fix Applied | Result | New Failures Revealed |
|
|
127
|
+
|---|---|---|---|---|---|
|
|
128
|
+
| 1 | ... | direct/analogy | ... | ... | ... |
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Part 2: Investigation
|
|
134
|
+
|
|
135
|
+
### 2.1 Hypothesis Discipline
|
|
136
|
+
|
|
137
|
+
**Not all hypotheses are created equal. Track their provenance.**
|
|
138
|
+
|
|
139
|
+
> *Evidence*: In three independent events (dex-hand EXP-005 USD instancing, flywheel SCALE_FACTOR, cortex-self EXP-050 TiledCamera), analogy-based reasoning led to wrong root cause identification, each costing 6h+ or introducing destructive changes.
|
|
140
|
+
|
|
141
|
+
#### Two types of hypotheses
|
|
142
|
+
|
|
143
|
+
| Type | Source | Examples | Confidence |
|
|
144
|
+
|---|---|---|---|
|
|
145
|
+
| **Direct evidence** | Error message, stack trace, log entry, reproduction | "Log says `KeyError: 'choices'`" | High — can act on it |
|
|
146
|
+
| **Analogy-based** | Similar issue, code comment, intuition, pattern matching | "Similar GitHub issue suggests USD instancing" | Low — must falsify first |
|
|
147
|
+
|
|
148
|
+
#### The rule
|
|
149
|
+
|
|
150
|
+
1. **Classify your hypothesis**: Is it from direct evidence or analogy?
|
|
151
|
+
2. **Check known traps**: Does this hypothesis touch a pattern you've been burned by before? (Check project knowledge entries in knowledge/index.md)
|
|
152
|
+
3. **If analogy-based → design a <30min falsification experiment** before investing in a fix
|
|
153
|
+
- Not "explore whether this hypothesis could be right" — design a test that would **disprove** it
|
|
154
|
+
- If the experiment fails to disprove → upgrade to working hypothesis
|
|
155
|
+
- If disproved → abandon immediately, don't sunk-cost deeper
|
|
156
|
+
4. **Label hypotheses explicitly** in your notes: `[hypothesis: direct]` vs `[hypothesis: analogy — needs falsification]`
|
|
157
|
+
|
|
158
|
+
#### Anti-pattern: "Similar issue exists, so that must be the cause"
|
|
159
|
+
|
|
160
|
+
Finding a similar-looking bug report or code comment is the **start** of an investigation, not the end. Three independent events proved that plausible-sounding analogies led to completely wrong root causes.
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### 2.2 Evidence Trust Hierarchy
|
|
165
|
+
|
|
166
|
+
When evaluating information sources during debugging, weight them accordingly:
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
Level 1 (highest): Direct observation — error message, log, symptom reproduction
|
|
170
|
+
Level 2: Official documentation + verified example code
|
|
171
|
+
Level 3: GitHub issue with reproduction steps + user confirmation
|
|
172
|
+
Level 4: Code comments with date and author context
|
|
173
|
+
Level 5: Commented-out code with no explanation
|
|
174
|
+
Level 6 (lowest): "I think I remember..." or unnamed conventions
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
> *Evidence*: dex-hand KNOWLEDGE.md §3.2 — code comments in `balanced.kit` ("DLSS frame gen does not yet support tiled camera well") pointed in the right direction but didn't explain the actual post-processing issue. Different interpretations led to different (wrong) debugging paths.
|
|
178
|
+
|
|
179
|
+
**Rule**: Information from Level 3-6 must be treated as hypotheses requiring falsification (see 2.1).
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
### 2.3 Cross-Component Value Tracing
|
|
184
|
+
|
|
185
|
+
**Before declaring a value "wrong", trace it through the entire pipeline.**
|
|
186
|
+
|
|
187
|
+
> *Evidence*: flywheel SCALE_FACTOR=0.01 was "fixed" to 1.0 because it looked like a bug. Actually it compensated for Isaac Sim's 100× USD magnification. The "fix" broke the pipeline.
|
|
188
|
+
|
|
189
|
+
**Rule**: When a value looks obviously wrong in one component, check:
|
|
190
|
+
1. What downstream component consumes this value?
|
|
191
|
+
2. Does the downstream component apply any transformation (scaling, offset, format conversion)?
|
|
192
|
+
3. Is this value compensating for a known behavior?
|
|
193
|
+
4. If you can't answer these questions → don't change the value; ask someone who knows
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### 2.4 Reproduction Completeness
|
|
198
|
+
|
|
199
|
+
**Some bugs require N conditions simultaneously. Missing one = can't reproduce.**
|
|
200
|
+
|
|
201
|
+
> *Evidence*: dex-hand EXP-005 — TiledCamera DL denoiser bug required ALL THREE: (1) TiledCameraCfg (not CameraCfg), (2) 20+ environments, (3) different visual content per env. Missing any one condition = no visible symptom. 4 envs with same content showed nothing.
|
|
202
|
+
|
|
203
|
+
#### Progressive reproduction protocol
|
|
204
|
+
|
|
205
|
+
When a bug resists simple reproduction:
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
Step 1: Minimal scene (basic geometry + small scale)
|
|
209
|
+
Step 2: Add one dimension of complexity (more components)
|
|
210
|
+
Step 3: Add another dimension (scale up)
|
|
211
|
+
Step 4: Add content diversity
|
|
212
|
+
Step 5: Match production configuration exactly
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Bug appears when you cross a step → that step's dimension is involved. Document **all** conditions required for reproduction — this prevents false "cannot reproduce" conclusions.
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
## Part 3: Fix Cycles
|
|
220
|
+
|
|
221
|
+
### 3.1 The Onion Layer Pattern
|
|
222
|
+
|
|
223
|
+
Multi-stage systems have bugs that layer: fixing one layer reveals the next.
|
|
224
|
+
|
|
225
|
+
```
|
|
226
|
+
Layer 1: Environment bugs (PATH, service startup, container conflicts)
|
|
227
|
+
Layer 2: Crash-level bugs (unhandled exceptions, resource exhaustion)
|
|
228
|
+
Layer 3: Protocol bugs (wrong field names, missing parameters)
|
|
229
|
+
Layer 4: Logic bugs (incorrect parsing, wrong code paths)
|
|
230
|
+
Layer 5: Robustness bugs (intermittent failures, edge cases)
|
|
231
|
+
Layer 6: Quality/diagnostic bugs (wrong failure reasons, silent data corruption)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
> *Evidence*: flywheel EXP-001→014 exposed 6 layers sequentially (environment → crash → exception handling → resource → service degradation → diagnostic quality). Same pattern re-emerged in EXP-024→027 (env dependencies → Docker conflicts → service fields → response content). Each 2-3x scale-up also reveals new layers.
|
|
235
|
+
|
|
236
|
+
**Plan for 3-5 fix cycles**, not 1. Each cycle typically moves you one layer deeper. If you're on fix cycle 6+, consider whether the architecture itself is the problem.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
### 3.2 Prioritized Fixing
|
|
241
|
+
|
|
242
|
+
**Fix issues in frequency × impact order. Batch related fixes.**
|
|
243
|
+
|
|
244
|
+
#### Rules
|
|
245
|
+
|
|
246
|
+
1. **Start from the highest-frequency failure**
|
|
247
|
+
- Fix the 67% problem before the 6% problem
|
|
248
|
+
- If a single root cause explains multiple failure types, fix that root cause
|
|
249
|
+
|
|
250
|
+
2. **Batch related fixes into a single cycle**
|
|
251
|
+
- If three diagnostic gaps are in the same code path, fix all three before re-running
|
|
252
|
+
- But don't mix diagnostic fixes with behavior fixes — separate concerns
|
|
253
|
+
|
|
254
|
+
3. **Each fix cycle follows `systematic-debugging` Phase 1-4**
|
|
255
|
+
- Root cause investigation → pattern analysis → hypothesis → implementation
|
|
256
|
+
- Single hypothesis at a time within each cycle
|
|
257
|
+
|
|
258
|
+
4. **After each fix, re-run the failure census (Part 1.2)**
|
|
259
|
+
- The distribution WILL change. New failures will emerge
|
|
260
|
+
- Update your frequency table. Re-prioritize.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
### 3.3 Hotfix Discipline
|
|
265
|
+
|
|
266
|
+
**Don't modify code while a test is running.**
|
|
267
|
+
|
|
268
|
+
> *Evidence*: flywheel EXP-006 — modified code mid-batch, then batch 2 ran with unverified fix. Created uncertainty: did the fix work, or did different inputs hide the problem?
|
|
269
|
+
|
|
270
|
+
**Rules**:
|
|
271
|
+
- Never change code during an active run — let it complete or kill it first
|
|
272
|
+
- Each run should correspond to exactly one known code state (ideally a git commit)
|
|
273
|
+
- If you need to fix something urgently, stop the current run, fix, commit, restart
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## Part 4: Verification
|
|
278
|
+
|
|
279
|
+
### 4.1 Statistical Discipline
|
|
280
|
+
|
|
281
|
+
**Verify that your fix actually helped, with enough statistical power to be confident.**
|
|
282
|
+
|
|
283
|
+
Small samples make it impossible to distinguish signal from noise:
|
|
284
|
+
|
|
285
|
+
| Sample Size | Observed Rate | 95% Confidence Interval |
|
|
286
|
+
|-------------|---------------|------------------------|
|
|
287
|
+
| 7 | 71% (5/7) | 29% – 96% |
|
|
288
|
+
| 14 | 71% (10/14) | 42% – 92% |
|
|
289
|
+
| 30 | 73% (22/30) | 54% – 88% |
|
|
290
|
+
| 50 | 72% (36/50) | 58% – 84% |
|
|
291
|
+
|
|
292
|
+
#### Rules
|
|
293
|
+
|
|
294
|
+
1. **Minimum smoke test size**: At least 14 samples. Double if baseline variance is high.
|
|
295
|
+
|
|
296
|
+
2. **Run the same test at least twice**: Two consecutive identical results (e.g., 10/14 + 10/14) is stronger evidence than one 10/14.
|
|
297
|
+
|
|
298
|
+
3. **Track trends, not snapshots**: Maintain a history table of results across fix cycles. Look for directional trends.
|
|
299
|
+
|
|
300
|
+
4. **Distinguish "fix worked" from "metric improved"**:
|
|
301
|
+
- The fix may correctly address one failure mode
|
|
302
|
+
- But the metric may not improve because another failure mode dominates
|
|
303
|
+
- This doesn't mean your fix was wrong — re-run the census
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
### 4.2 The Unit Test → Smoke Test Gap
|
|
308
|
+
|
|
309
|
+
**Unit tests mock external dependencies. They cannot catch real-system failures.**
|
|
310
|
+
|
|
311
|
+
> *Evidence*: This pattern repeated 4 independent times in flywheel:
|
|
312
|
+
> - EXP-021: 19/19 unit tests pass → EXP-022: 5/7 smoke test failures
|
|
313
|
+
> - EXP-026: 2 tests pass → EXP-027: 4/7 failures
|
|
314
|
+
> - EXP-030: 29 tests pass → EXP-033: 2/7 residual
|
|
315
|
+
> - EXP-032: 34 tests pass → EXP-033: still residual failures
|
|
316
|
+
|
|
317
|
+
**What mocks cannot catch**:
|
|
318
|
+
- Real service output format changes (e.g., `reasoning_content` vs `content`)
|
|
319
|
+
- Service-specific failure modes (think-only responses, truncated JSON)
|
|
320
|
+
- Service-layer silent failures (`response.success=False` bypassing stage-level logging)
|
|
321
|
+
- Resource contention and timing issues
|
|
322
|
+
|
|
323
|
+
**Correct workflow**: fix → unit test (regression protection) → smoke test (real-service verification) → write conclusions. Never skip the smoke test.
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
### 4.3 Progressive Scaling
|
|
328
|
+
|
|
329
|
+
**Test at increasing scales, not just minimum or maximum.**
|
|
330
|
+
|
|
331
|
+
> *Evidence*: flywheel EXP-006 jumped from 5 → 21 objects, wasting compute to discover GPU descriptor pool exhaustion (B9). dex-hand EXP-005 showed bugs that only appear at 20+ environments, invisible at 4.
|
|
332
|
+
|
|
333
|
+
```
|
|
334
|
+
Scale 1: Unit test (mocked, fast, catches regressions)
|
|
335
|
+
Scale 2: Smoke test (real service, small: 7-14 items)
|
|
336
|
+
Scale 3: Medium run (real service, 30-50 items)
|
|
337
|
+
Scale 4: Full production run
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**Rules**:
|
|
341
|
+
- Each scale must pass before proceeding to the next
|
|
342
|
+
- GPU/resource bugs typically emerge at Scale 3
|
|
343
|
+
- Service degradation/fatigue bugs emerge at Scale 4 after extended runtime
|
|
344
|
+
- Never skip directly from Scale 1 to Scale 4
|
|
345
|
+
|
|
346
|
+
---
|
|
347
|
+
|
|
348
|
+
## Part 5: Campaign Management
|
|
349
|
+
|
|
350
|
+
### 5.1 When to Escalate to Human
|
|
351
|
+
|
|
352
|
+
Not all debugging can or should proceed autonomously. Escalate when:
|
|
353
|
+
|
|
354
|
+
| Signal | Why | Action |
|
|
355
|
+
|---|---|---|
|
|
356
|
+
| >2 hours on a single hypothesis without direct evidence | Likely anchored on wrong model | Ask human for domain insight |
|
|
357
|
+
| About to change a non-obvious numerical value | May be intentional compensation | Verify purpose with human first |
|
|
358
|
+
| Hypothesis is purely analogy-based and falsification experiment failed | Need domain expertise | Present findings, ask for direction |
|
|
359
|
+
| 3+ fix cycles without measurable progress | May be architectural problem | Discuss with human before cycle 4 |
|
|
360
|
+
| Debugging involves shared resources (GPU, services) | May affect other users | Confirm before taking action |
|
|
361
|
+
|
|
362
|
+
---
|
|
363
|
+
|
|
364
|
+
### 5.2 When to Re-Census
|
|
365
|
+
|
|
366
|
+
Re-run the failure census (Part 1.2) when:
|
|
367
|
+
- A fix cycle completed (success or failure)
|
|
368
|
+
- The observed failure distribution seems to have shifted
|
|
369
|
+
- A new symptom appeared that wasn't in the original census
|
|
370
|
+
- You've been working on the same failure type for 2+ cycles without progress
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
### 5.3 Campaign Closure
|
|
375
|
+
|
|
376
|
+
**Before declaring "done", verify against the original success criteria.**
|
|
377
|
+
|
|
378
|
+
#### Closure Checklist
|
|
379
|
+
|
|
380
|
+
1. **Does the metric meet the target?** (not "improved" — meets the actual numeric target)
|
|
381
|
+
2. **Is the improvement stable?** (at least 2 consecutive runs at or above target)
|
|
382
|
+
3. **Are there known remaining failure modes?** (document them; classify as fixable vs. inherent)
|
|
383
|
+
4. **Update knowledge artifacts**: failure modes, diagnostic infrastructure added, learned knowledge entries (knowledge/K-NNN.md), STATUS.md, experiment entries (experiments/EXP-NNN.md)
|
|
384
|
+
|
|
385
|
+
#### The "Another Layer" Decision
|
|
386
|
+
|
|
387
|
+
After each fix cycle:
|
|
388
|
+
- **Hit target?** → Close the campaign
|
|
389
|
+
- **Measurable progress but not enough?** → Continue, re-census first
|
|
390
|
+
- **No progress despite correct fix?** → New dominant failure mode emerged; re-census
|
|
391
|
+
- **5+ cycles without target?** → Is the target achievable with this architecture?
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Part 6: Domain-Specific Patterns
|
|
396
|
+
|
|
397
|
+
### 6.1 Service / API Debugging
|
|
398
|
+
|
|
399
|
+
When debugging systems that call external services (LLM APIs, inference servers, microservices):
|
|
400
|
+
|
|
401
|
+
**Capture raw responses first.** Before analyzing parsing logic, save the complete raw provider response on every failure path. The root cause is often in what the service returned, not in how you parsed it.
|
|
402
|
+
|
|
403
|
+
> *Evidence*: flywheel EXP-026 — root cause was service layer field selection (`reasoning_content` vs `content`), but 3 prior experiments debugged the stage/parsing layer because no raw response was captured.
|
|
404
|
+
|
|
405
|
+
**Service fatigue.** Long-running GPU services degrade over time: memory fragmentation, state corruption, resource leaks. If failures increase with runtime duration, implement periodic restarts or health checks.
|
|
406
|
+
|
|
407
|
+
> *Evidence*: flywheel EXP-011 — TRELLIS2 normal for batches 1-5, degraded 6-10, completely failed 11+. 7 hours continuous runtime.
|
|
408
|
+
|
|
409
|
+
**Transient vs. persistent failures.** Distinguish BEFORE adding retry logic:
|
|
410
|
+
- **Transient**: Empty responses, timeouts → Single retry with backoff
|
|
411
|
+
- **Persistent**: Wrong field names, missing capabilities → Fix code, no retry
|
|
412
|
+
- Retrying a persistent failure wastes time and quota
|
|
413
|
+
|
|
414
|
+
**Call path drift.** Services with `call()` (single) and `call_batch()` (batch) paths drift apart over time. When you find a bug in one path, immediately check the other for the same class of issue.
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
### 6.2 Rendering / GPU Debugging
|
|
419
|
+
|
|
420
|
+
When debugging rendering pipelines (Isaac Sim, game engines, visualization):
|
|
421
|
+
|
|
422
|
+
**Layer-by-layer isolation.** Rendering pipelines have multiple implicit post-processing layers. Each can independently introduce artifacts, and artifacts compound across layers.
|
|
423
|
+
|
|
424
|
+
```
|
|
425
|
+
Scene Construction → Ray Tracing → [DL Denoiser] → [DLSS/TAA] → [Cached RT] → Output
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
> *Evidence*: dex-hand EXP-004 (DLSS jitter) and EXP-005 (DL denoiser cross-tile bleeding) — both symptoms appeared in rendered output but root causes were in different post-processing layers.
|
|
429
|
+
|
|
430
|
+
**Debug protocol**:
|
|
431
|
+
1. Check rendering configuration files for enabled post-processing stages
|
|
432
|
+
2. Disable each post-processing stage independently
|
|
433
|
+
3. Identify which stage isolates the symptom
|
|
434
|
+
4. Only then investigate scene/camera configuration
|
|
435
|
+
|
|
436
|
+
**Multi-condition reproduction.** Rendering bugs often require N conditions simultaneously. Progressive reproduction protocol (see 2.4) is essential.
|
|
437
|
+
|
|
438
|
+
**GPU resource awareness.** Check `nvidia-smi` before and during runs. GPU descriptor pool exhaustion, memory fragmentation, and VRAM limits can cause symptoms that look like logic bugs.
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
### 6.3 Multi-Stage Pipeline Debugging
|
|
443
|
+
|
|
444
|
+
When debugging pipelines with sequential stages:
|
|
445
|
+
|
|
446
|
+
**Identify the real bottleneck stage.** The stage that shows failures in logs may not be the actual bottleneck — a failure upstream can cascade to appear as failures in multiple downstream stages.
|
|
447
|
+
|
|
448
|
+
**Per-stage pass rate tracking.** Maintain a history table of pass rates per stage across experiments. This reveals trends invisible in single-run snapshots.
|
|
449
|
+
|
|
450
|
+
```
|
|
451
|
+
| Experiment | Stage A | Stage B | Stage C | Stage D |
|
|
452
|
+
|------------|---------|---------|---------|---------|
|
|
453
|
+
| EXP-001 | 100% | 80% | 100% | 68% |
|
|
454
|
+
| EXP-010 | 100% | 100% | 92.9% | 70% |
|
|
455
|
+
| EXP-033 | 71.4% | 100% | 80% | 89.6% |
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
**Naming/configuration verification.** When comparing two runs or two model checkpoints, always create a configuration comparison table listing all dimensions that could differ. Checkpoint names can be misleading.
|
|
459
|
+
|
|
460
|
+
> *Evidence*: dex-hand EXP-002 — model5-1 vs model10 improvement was attributed to data scaling, but the actual change was modality (adding tactile). Names didn't encode the difference.
|
|
461
|
+
|
|
462
|
+
**Scaling reveals new bug layers.** Each 2-3x scale-up exposes new failure types (resource contention, service fatigue, edge cases). Scale gradually: 5 → 14 → 50 → production.
|
|
463
|
+
|
|
464
|
+
---
|
|
465
|
+
|
|
466
|
+
## Part 7: Anti-Pattern Summary
|
|
467
|
+
|
|
468
|
+
| Anti-Pattern | Cost | Instead |
|
|
469
|
+
|---|---|---|
|
|
470
|
+
| Build diagnostics reactively | 2-3x more fix cycles | Part 1.1: instrument everything upfront |
|
|
471
|
+
| Fix the first failure you see | Miss the dominant root cause | Part 1.2: census first, prioritize by frequency |
|
|
472
|
+
| Treat analogy as conclusion | 6h+ wasted on wrong hypothesis | Part 2.1: classify hypothesis, falsify analogies |
|
|
473
|
+
| Trust code comments as facts | Wrong debugging direction | Part 2.2: apply evidence trust hierarchy |
|
|
474
|
+
| Change "obviously wrong" values | Break intentional compensation | Part 2.3: trace value through full pipeline |
|
|
475
|
+
| Give up on reproduction too early | Miss multi-condition bugs | Part 2.4: progressive reproduction protocol |
|
|
476
|
+
| Expect one fix to close it | Surprised by onion layers | Part 3.1: plan for 3-5 cycles |
|
|
477
|
+
| Hotfix during a running test | Can't attribute results to code state | Part 3.3: stop, fix, commit, restart |
|
|
478
|
+
| Test with tiny samples (n=7) | Can't distinguish signal from noise | Part 4.1: minimum n=14, run twice |
|
|
479
|
+
| Unit test = verified | Misses real-service failures | Part 4.2: always run smoke test after unit tests |
|
|
480
|
+
| Skip from unit test to full scale | Waste compute on known-broken code | Part 4.3: scale gradually (7→14→50→full) |
|
|
481
|
+
| Debug solo for >2 hours on analogy | Anchoring on wrong mental model | Part 5.1: escalate to human |
|
|
482
|
+
| Same logging bug in one stage only | Same pattern exists in other stages | Part 1.1: check for diagnostic bug propagation |
|
|
483
|
+
| Compare without config table | Misattribute improvements to wrong variable | Part 6.3: always create config comparison table |
|
|
484
|
+
|
|
485
|
+
---
|
|
486
|
+
|
|
487
|
+
## Quick Decision Tree
|
|
488
|
+
|
|
489
|
+
```
|
|
490
|
+
Starting a debug task?
|
|
491
|
+
├── Single, clearly reproducible bug?
|
|
492
|
+
│ └── Use systematic-debugging directly
|
|
493
|
+
├── Multiple failures or intermittent?
|
|
494
|
+
│ ├── Have diagnostic coverage? (Part 1.1)
|
|
495
|
+
│ │ ├── No → INSTRUMENT FIRST
|
|
496
|
+
│ │ └── Yes → Have failure census? (Part 1.2)
|
|
497
|
+
│ │ ├── No → Run census, build frequency table
|
|
498
|
+
│ │ └── Yes → Fix highest-frequency issue (Part 3)
|
|
499
|
+
│ │ ├── Hypothesis from direct evidence? → Act on it
|
|
500
|
+
│ │ └── Hypothesis from analogy? → Falsify first (Part 2.1)
|
|
501
|
+
│ └── After fix: re-census (Part 5.2), check target (Part 5.3)
|
|
502
|
+
├── 3+ fix cycles without convergence?
|
|
503
|
+
│ └── Re-evaluate: wrong root cause, wrong hypothesis type, or architectural problem?
|
|
504
|
+
├── Can't reproduce?
|
|
505
|
+
│ └── Progressive reproduction protocol (Part 2.4)
|
|
506
|
+
└── Non-obvious value looks wrong?
|
|
507
|
+
└── Trace full pipeline before changing (Part 2.3)
|
|
508
|
+
```
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagnose
|
|
3
|
+
description: "Use when experimental results are unexpected, confusing, or need interpretation — error patterns, root-cause hypotheses, validity assessment"
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Read
|
|
6
|
+
- Grep
|
|
7
|
+
- Glob
|
|
8
|
+
- Bash
|
|
9
|
+
argument-hint: "[results path, experiment ID, or description of what to examine]"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# /diagnose <results path or description>
|
|
13
|
+
|
|
14
|
+
You are diagnosing empirical results — finding patterns in errors, generating hypotheses about root causes, and assessing whether the results mean what they appear to mean. This is the analytical complement to `/synthesize` (which works across accumulated findings); `/diagnose` works within one result set.
|
|
15
|
+
|
|
16
|
+
The argument is a path to results (CSV, log, experiment output) or a description of what to examine. Read the data first.
|
|
17
|
+
|
|
18
|
+
## When to use this vs alternatives
|
|
19
|
+
|
|
20
|
+
- **Use `/diagnose`** when you have *empirical results* (metrics, error logs, experiment outputs) and want to understand what they mean — error patterns, root-cause hypotheses, validity assessment.
|
|
21
|
+
- **Use `/postmortem`** when the problem is not "what do the results mean?" but "why did an agent report flawed results as correct?" Postmortem analyzes *reasoning failures*; diagnose analyzes *data*.
|
|
22
|
+
- **Use `/review`** when you suspect the metrics themselves may be degenerate or misleading before interpreting the results. `/review` checks whether results are interpretable; `/diagnose` interprets them.
|
|
23
|
+
- **Use `/critique`** for broad adversarial review of an artifact's quality. Critique is proactive ("find problems in this plan"); diagnose is focused ("explain these results").
|
|
24
|
+
|
|
25
|
+
## Step 1: Understand the experiment
|
|
26
|
+
|
|
27
|
+
- Read the results file and any associated experiment entries (experiments/EXP-NNN.md files).
|
|
28
|
+
- Identify what was measured, what was varied, and what the expected outcome was.
|
|
29
|
+
- Read the experiment design or method description if one exists.
|
|
30
|
+
- Identify which system layers are involved (model, pipeline, evaluation, data, etc.).
|
|
31
|
+
|
|
32
|
+
## Step 2: Characterize the error distribution
|
|
33
|
+
|
|
34
|
+
Do not start with individual examples. Start with the distribution:
|
|
35
|
+
|
|
36
|
+
- **Overall rates**: What is the base rate of success/failure? How does it compare to random chance or a naive baseline?
|
|
37
|
+
- **Conditional rates**: Break errors down by every available dimension (model, category, run number, stage, etc.). Where are errors concentrated?
|
|
38
|
+
- **Error types**: Categorize errors. Are they systematic (same direction, same condition) or random (scattered)? Common categories:
|
|
39
|
+
- Wrong direction (predicted opposite of truth)
|
|
40
|
+
- False consensus (called a tie when ground truth disagrees)
|
|
41
|
+
- False distinction (picked a winner when ground truth says tie)
|
|
42
|
+
- Magnitude error (correct direction but wrong confidence)
|
|
43
|
+
- Parse/format error (output malformed, couldn't extract answer)
|
|
44
|
+
- Timeout/crash (infrastructure failure, not model failure)
|
|
45
|
+
- **Temporal patterns**: Do error rates change over runs? Is there a position effect, order effect, or degradation pattern? (Cross-reference K-022: GPU services degrade after long runs.)
|
|
46
|
+
|
|
47
|
+
If the data is in CSV or structured format, use `python` to compute breakdowns rather than eyeballing.
|
|
48
|
+
|
|
49
|
+
## Step 3: Generate root-cause hypotheses
|
|
50
|
+
|
|
51
|
+
For each systematic error pattern found in Step 2, generate candidate explanations. For each hypothesis:
|
|
52
|
+
|
|
53
|
+
- **State the hypothesis** as a testable claim (e.g., "Model underestimates texture quality because multi-view renders lose detail at low resolution")
|
|
54
|
+
- **Name the system layer** where the root cause lives:
|
|
55
|
+
- **Model**: the LLM/VLM lacks the capability (e.g., can't perceive geometric detail)
|
|
56
|
+
- **Pipeline/Workflow**: the pipeline introduces the error (e.g., compression, prompt structure, response parsing)
|
|
57
|
+
- **Interface**: the presentation format loses information (e.g., static renders vs interactive viewing)
|
|
58
|
+
- **Methodology**: the metric misrepresents performance (e.g., threshold too aggressive, ground truth noisy)
|
|
59
|
+
- **Data/Ground truth**: the ground truth itself is questionable (e.g., low inter-annotator agreement)
|
|
60
|
+
- **State what evidence would confirm or refute** this hypothesis
|
|
61
|
+
- **Rate plausibility**: high (consistent with multiple error patterns), medium (consistent but other explanations exist), low (speculative)
|
|
62
|
+
|
|
63
|
+
**Resist the temptation to attribute everything to the model.** Most errors in automated systems come from pipeline, interface, or methodology issues. (Cross-reference K-017: analogical reasoning needs to be labeled as hypothesis, not conclusion.)
|
|
64
|
+
|
|
65
|
+
## Step 4: Assess validity
|
|
66
|
+
|
|
67
|
+
Before interpreting the results as meaningful, check:
|
|
68
|
+
|
|
69
|
+
- **Construct validity**: Does the measurement capture what it claims to? Where is the gap between operationalization and construct?
|
|
70
|
+
- **Statistical validity**: Is the sample size sufficient? Are observed differences larger than expected noise? Compute confidence intervals or significance tests if possible.
|
|
71
|
+
- **External validity**: Would these results generalize to other datasets, models, prompt formats? What are the boundary conditions?
|
|
72
|
+
- **Ground truth quality**: How reliable is the ground truth? Are there known biases in the reference data?
|
|
73
|
+
|
|
74
|
+
(Cross-reference K-005: incomplete evaluations produce misleading conclusions — always verify all dimensions.)
|
|
75
|
+
|
|
76
|
+
## Step 5: Recommend next steps
|
|
77
|
+
|
|
78
|
+
Based on the diagnosis, recommend concrete actions:
|
|
79
|
+
|
|
80
|
+
- **Quick wins**: Changes that could improve results with minimal effort (e.g., adjusting a threshold, fixing a prompt)
|
|
81
|
+
- **Experiments needed**: Hypotheses that require new experiments to test
|
|
82
|
+
- **Validity concerns**: Issues that need to be resolved before interpreting results further
|
|
83
|
+
- **What NOT to do**: Common reactions that would be wrong given the diagnosis (e.g., "don't retrain on this data because the ground truth is noisy")
|
|
84
|
+
|
|
85
|
+
## Output format
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
## Diagnosis: <what was examined>
|
|
89
|
+
System layers involved: <which layers>
|
|
90
|
+
Date: YYYY-MM-DD
|
|
91
|
+
|
|
92
|
+
### Error distribution
|
|
93
|
+
<rates, breakdowns, error type categorization — with specific numbers>
|
|
94
|
+
|
|
95
|
+
### Systematic patterns
|
|
96
|
+
<numbered list of patterns with evidence>
|
|
97
|
+
|
|
98
|
+
### Root-cause hypotheses
|
|
99
|
+
|
|
100
|
+
#### Hypothesis 1: <testable claim>
|
|
101
|
+
Layer: <model / pipeline / interface / methodology / data>
|
|
102
|
+
Evidence for: <what supports this>
|
|
103
|
+
Evidence against: <what contradicts this>
|
|
104
|
+
Test: <what experiment would confirm/refute>
|
|
105
|
+
Plausibility: high | medium | low
|
|
106
|
+
|
|
107
|
+
[repeat for each hypothesis]
|
|
108
|
+
|
|
109
|
+
### Validity assessment
|
|
110
|
+
- Construct: <assessment>
|
|
111
|
+
- Statistical: <assessment>
|
|
112
|
+
- External: <assessment>
|
|
113
|
+
- Ground truth: <assessment>
|
|
114
|
+
|
|
115
|
+
### Recommended actions
|
|
116
|
+
- Quick wins: <bulleted>
|
|
117
|
+
- Experiments needed: <bulleted, with enough detail to design>
|
|
118
|
+
- Validity concerns: <bulleted>
|
|
119
|
+
- Avoid: <what not to do and why>
|
|
120
|
+
|
|
121
|
+
### Structural escalation
|
|
122
|
+
Tests triggered: <list which of the 5 tests pointed to "structural concern", or "none">
|
|
123
|
+
Action: <"Logged structural review task" | "Not triggered — tactical fix sufficient">
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Prioritize depth over breadth. One well-grounded hypothesis with clear evidence is worth more than five speculative ones.
|
|
127
|
+
|
|
128
|
+
## Step 6: Structural escalation check
|
|
129
|
+
|
|
130
|
+
Before closing the diagnosis, apply five tests to the root-cause hypotheses from Step 3. The goal is to distinguish tactical fixes (engineering) from problems that require new understanding (a structural rethink).
|
|
131
|
+
|
|
132
|
+
**1. Understanding test** (most important):
|
|
133
|
+
Can I explain *why* this problem exists — the generating mechanism — not just *what* it is?
|
|
134
|
+
If only symptoms are clear but the mechanism is unknown → knowledge gap.
|
|
135
|
+
|
|
136
|
+
**2. Generalization test**:
|
|
137
|
+
Is this specific to our implementation, or would anyone building a similar system face it?
|
|
138
|
+
If it generalizes → domain-level problem, not an engineering bug.
|
|
139
|
+
|
|
140
|
+
**3. Solution existence test**:
|
|
141
|
+
Does a known, proven solution exist in established practice?
|
|
142
|
+
If not → requires deeper investigation to produce new understanding.
|
|
143
|
+
|
|
144
|
+
**4. Recurrence test**:
|
|
145
|
+
Has this *class* of problem appeared before in a different form?
|
|
146
|
+
Check project ISSUES.md and experiment entries (experiments/index.md or grep experiments/) for variants. Same class of problem recurring despite fixes → treating symptoms, not root cause.
|
|
147
|
+
|
|
148
|
+
**5. Trade-off nature test**:
|
|
149
|
+
Can more resources (compute, time, data) resolve this, or is there a fundamental tension that no amount of resources can overcome?
|
|
150
|
+
Resource-solvable → engineering. Fundamental tension → structural.
|
|
151
|
+
|
|
152
|
+
**Scoring**: If ≥2 tests point toward "structural" → log a structural review task with the problem statement and evidence from this diagnosis. Add a `[structural-escalation]` section to the output.
|
|
153
|
+
|
|
154
|
+
If <2 → proceed with tactical fix recommendations only. Note "Structural escalation: not triggered" in the output.
|
|
155
|
+
|
|
156
|
+
## Save to disk
|
|
157
|
+
|
|
158
|
+
Write the diagnosis to the relevant project directory: `context/projects/<project>/` as a new experiment file (experiments/EXP-NNN.md) or as a standalone analysis file. Reference the source experiment ID.
|
|
159
|
+
|
|
160
|
+
## Task Bridge
|
|
161
|
+
|
|
162
|
+
After saving, convert actionable recommendations to tasks:
|
|
163
|
+
|
|
164
|
+
1. For each item in "Quick wins" and "Experiments needed":
|
|
165
|
+
- Check the project's TASKS.md for existing tasks covering the same action
|
|
166
|
+
- If no existing task, create one with provenance referencing this diagnosis
|
|
167
|
+
- Skip items that are purely observational
|
|
168
|
+
2. For "Validity concerns" that require follow-up experiments: create a task referencing `/solution-design` for methodology
|
|
169
|
+
3. Do NOT create tasks for "What NOT to do" items — these are anti-patterns, not actions
|