@bonesofspring/ai-rules 0.2.65 → 0.2.67
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/CHANGELOG.md +56 -0
- package/README.md +21 -11
- package/bin/cli.js +9 -1
- package/bin/lib/engine-scripts.js +34 -7
- package/bin/lib/engine-upgrade.js +5 -2
- package/bin/lib/seed-ai-local-team.js +32 -3
- package/docs/OPENCODE-COMPATIBILITY.md +1 -0
- package/docs/OPENCODE.md +31 -10
- package/docs/TEAM-DB.md +54 -14
- package/docs/TOKEN-ECONOMY.md +110 -0
- package/docs/openapi/team-db.v1.json +5 -5
- package/package.json +16 -3
- package/presets/_shared/ai-local/scripts/dump-output.mjs +422 -0
- package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +3 -3
- package/presets/_shared/ai-local/scripts/team-db-tracker.mjs +2 -0
- package/presets/_shared/ai-local/scripts/team-db.mjs +82 -2
- package/presets/_shared/core/agent-team/agent-team-orchestrator.md +3 -1
- package/presets/_shared/core/architecture/feature-delivery-workflow.md +4 -0
- package/presets/_shared/core/quality/context-and-iteration.md +1 -0
- package/presets/_shared/hooks/chain-team-phases.sh.tmpl +9 -2
- package/presets/_shared/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/android-kotlin/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/claude/go/agents/task-analyst.md +1 -1
- package/presets/claude/go/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/go/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/go/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/go/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/claude/ios-swift/agents/task-analyst.md +1 -1
- package/presets/claude/ios-swift/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/ios-swift/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/ios-swift/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/claude/java/agents/task-analyst.md +1 -1
- package/presets/claude/java/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/java/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/java/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/java/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/claude/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/mcp-ts/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/mcp-ts/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/claude/mol/agents/task-analyst.md +1 -1
- package/presets/claude/mol/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/mol/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/mol/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/claude/next/agents/ci-investigator.md +5 -2
- package/presets/claude/next/agents/debugger.md +5 -2
- package/presets/claude/next/agents/feature-developer.md +5 -2
- package/presets/claude/next/agents/task-analyst.md +1 -1
- package/presets/claude/next/commands/README.md +1 -1
- package/presets/claude/next/commands/task.md +1 -1
- package/presets/claude/next/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/next/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/next/rules/architecture/feature-delivery-workflow.md +8 -0
- package/presets/claude/next/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/claude/next/team/README.md +7 -3
- package/presets/claude/nuxt/agents/task-analyst.md +1 -1
- package/presets/claude/nuxt/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/nuxt/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/nuxt/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/claude/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/php-hexagonal/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/php-hexagonal/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/claude/php-laravel/agents/task-analyst.md +1 -1
- package/presets/claude/php-laravel/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/php-laravel/rules/architecture/feature-delivery.md +4 -0
- package/presets/claude/php-laravel/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/claude/svelte/agents/task-analyst.md +1 -1
- package/presets/claude/svelte/hooks/chain-team-phases.sh +9 -2
- package/presets/claude/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/claude/svelte/rules/architecture/feature-delivery-workflow.md +4 -0
- package/presets/claude/svelte/rules/tooling-and-review/agent-team-orchestrator.md +3 -1
- package/presets/cursor/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/android-kotlin/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/go/agents/task-analyst.md +1 -1
- package/presets/cursor/go/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/go/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/go/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/ios-swift/agents/task-analyst.md +1 -1
- package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/ios-swift/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/java/agents/task-analyst.md +1 -1
- package/presets/cursor/java/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/java/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/java/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/mcp-ts/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/mol/agents/task-analyst.md +1 -1
- package/presets/cursor/mol/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/mol/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/next/agents/task-analyst.md +1 -1
- package/presets/cursor/next/commands/README.md +1 -1
- package/presets/cursor/next/commands/task.md +1 -1
- package/presets/cursor/next/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/next/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/next/rules/agent-team-orchestrator.mdc +3 -1
- package/presets/cursor/next/rules/feature-delivery-workflow.mdc +4 -0
- package/presets/cursor/next/team/README.md +7 -3
- package/presets/cursor/nuxt/agents/task-analyst.md +1 -1
- package/presets/cursor/nuxt/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/nuxt/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/php-hexagonal/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/php-laravel/agents/task-analyst.md +1 -1
- package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/php-laravel/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/cursor/svelte/agents/task-analyst.md +1 -1
- package/presets/cursor/svelte/hooks/chain-team-phases.sh +9 -2
- package/presets/cursor/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/cursor/svelte/rules/agent-team-orchestrator.mdc +1 -1
- package/presets/mavis/android-kotlin/adapter-map.json +1 -1
- package/presets/mavis/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/android-kotlin/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/go/adapter-map.json +1 -1
- package/presets/mavis/go/agents/task-analyst.md +1 -1
- package/presets/mavis/go/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/go/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/go/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/ios-swift/adapter-map.json +1 -1
- package/presets/mavis/ios-swift/agents/task-analyst.md +1 -1
- package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/ios-swift/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/java/adapter-map.json +1 -1
- package/presets/mavis/java/agents/task-analyst.md +1 -1
- package/presets/mavis/java/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/java/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/java/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/mcp-ts/adapter-map.json +1 -1
- package/presets/mavis/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/mcp-ts/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/mol/adapter-map.json +1 -1
- package/presets/mavis/mol/agents/task-analyst.md +1 -1
- package/presets/mavis/mol/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/mol/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/next/adapter-map.json +9 -1
- package/presets/mavis/next/agents/ci-investigator.md +5 -2
- package/presets/mavis/next/agents/debugger.md +5 -2
- package/presets/mavis/next/agents/feature-developer.md +5 -2
- package/presets/mavis/next/agents/task-analyst.md +1 -1
- package/presets/mavis/next/commands/README.md +1 -1
- package/presets/mavis/next/commands/task.md +1 -1
- package/presets/mavis/next/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/next/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/next/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/next/rules/feature-delivery-workflow.md +8 -0
- package/presets/mavis/next/team/README.md +7 -3
- package/presets/mavis/nuxt/adapter-map.json +1 -1
- package/presets/mavis/nuxt/agents/task-analyst.md +1 -1
- package/presets/mavis/nuxt/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/nuxt/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
- package/presets/mavis/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/php-hexagonal/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/php-laravel/adapter-map.json +1 -1
- package/presets/mavis/php-laravel/agents/task-analyst.md +1 -1
- package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/php-laravel/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/mavis/svelte/adapter-map.json +1 -1
- package/presets/mavis/svelte/agents/task-analyst.md +1 -1
- package/presets/mavis/svelte/hooks/chain-team-phases.sh +9 -2
- package/presets/mavis/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/mavis/svelte/rules/agent-team-orchestrator.md +3 -1
- package/presets/mavis/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/android-kotlin/adapter-map.json +1 -1
- package/presets/opencode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/android-kotlin/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/go/adapter-map.json +1 -1
- package/presets/opencode/go/agents/task-analyst.md +1 -1
- package/presets/opencode/go/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/go/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/go/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/ios-swift/adapter-map.json +1 -1
- package/presets/opencode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/ios-swift/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/java/adapter-map.json +1 -1
- package/presets/opencode/java/agents/task-analyst.md +1 -1
- package/presets/opencode/java/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/java/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/java/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/mcp-ts/adapter-map.json +1 -1
- package/presets/opencode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/mcp-ts/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/mol/adapter-map.json +1 -1
- package/presets/opencode/mol/agents/task-analyst.md +1 -1
- package/presets/opencode/mol/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/mol/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/next/adapter-map.json +9 -1
- package/presets/opencode/next/agents/ci-investigator.md +5 -2
- package/presets/opencode/next/agents/debugger.md +5 -2
- package/presets/opencode/next/agents/feature-developer.md +5 -2
- package/presets/opencode/next/agents/task-analyst.md +1 -1
- package/presets/opencode/next/commands/README.md +1 -1
- package/presets/opencode/next/commands/task.md +1 -1
- package/presets/opencode/next/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/next/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/next/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/next/rules/feature-delivery-workflow.md +8 -0
- package/presets/opencode/next/team/README.md +7 -3
- package/presets/opencode/nuxt/adapter-map.json +1 -1
- package/presets/opencode/nuxt/agents/task-analyst.md +1 -1
- package/presets/opencode/nuxt/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/nuxt/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
- package/presets/opencode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/php-hexagonal/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/php-laravel/adapter-map.json +1 -1
- package/presets/opencode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/php-laravel/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/opencode/plugins/output-guard/README.md +43 -0
- package/presets/opencode/plugins/output-guard/index.ts +300 -0
- package/presets/opencode/plugins/output-guard/package.json +9 -0
- package/presets/opencode/plugins/output-guard/rewrite.ts +149 -0
- package/presets/opencode/plugins/task-status/README.md +23 -11
- package/presets/opencode/plugins/task-status/details-data.ts +64 -46
- package/presets/opencode/plugins/task-status/details.tsx +12 -2
- package/presets/opencode/plugins/task-status/format.ts +16 -0
- package/presets/opencode/plugins/task-status/prompt-text.ts +37 -0
- package/presets/opencode/plugins/task-status/task-view.ts +281 -179
- package/presets/opencode/plugins/task-status/tui.tsx +60 -16
- package/presets/opencode/plugins/task-status/types.ts +74 -0
- package/presets/opencode/svelte/adapter-map.json +1 -1
- package/presets/opencode/svelte/agents/task-analyst.md +1 -1
- package/presets/opencode/svelte/hooks/chain-team-phases.sh +9 -2
- package/presets/opencode/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/opencode/svelte/rules/agent-team-orchestrator.md +3 -1
- package/presets/opencode/svelte/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/android-kotlin/adapter-map.json +1 -1
- package/presets/zcode/android-kotlin/agents/task-analyst.md +1 -1
- package/presets/zcode/android-kotlin/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/android-kotlin/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/android-kotlin/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/go/adapter-map.json +1 -1
- package/presets/zcode/go/agents/task-analyst.md +1 -1
- package/presets/zcode/go/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/go/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/go/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/go/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/ios-swift/adapter-map.json +1 -1
- package/presets/zcode/ios-swift/agents/task-analyst.md +1 -1
- package/presets/zcode/ios-swift/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/ios-swift/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/ios-swift/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/ios-swift/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/java/adapter-map.json +1 -1
- package/presets/zcode/java/agents/task-analyst.md +1 -1
- package/presets/zcode/java/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/java/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/java/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/java/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/mcp-ts/adapter-map.json +1 -1
- package/presets/zcode/mcp-ts/agents/task-analyst.md +1 -1
- package/presets/zcode/mcp-ts/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/mcp-ts/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/mcp-ts/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/mcp-ts/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/mol/adapter-map.json +1 -1
- package/presets/zcode/mol/agents/task-analyst.md +1 -1
- package/presets/zcode/mol/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/mol/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/mol/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/mol/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/next/adapter-map.json +9 -1
- package/presets/zcode/next/agents/ci-investigator.md +5 -2
- package/presets/zcode/next/agents/debugger.md +5 -2
- package/presets/zcode/next/agents/feature-developer.md +5 -2
- package/presets/zcode/next/agents/task-analyst.md +1 -1
- package/presets/zcode/next/commands/README.md +1 -1
- package/presets/zcode/next/commands/task.md +1 -1
- package/presets/zcode/next/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/next/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/next/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/next/rules/feature-delivery-workflow.md +8 -0
- package/presets/zcode/next/team/README.md +7 -3
- package/presets/zcode/nuxt/adapter-map.json +1 -1
- package/presets/zcode/nuxt/agents/task-analyst.md +1 -1
- package/presets/zcode/nuxt/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/nuxt/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/nuxt/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/nuxt/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/php-hexagonal/adapter-map.json +1 -1
- package/presets/zcode/php-hexagonal/agents/task-analyst.md +1 -1
- package/presets/zcode/php-hexagonal/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/php-hexagonal/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/php-hexagonal/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/php-hexagonal/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/php-laravel/adapter-map.json +1 -1
- package/presets/zcode/php-laravel/agents/task-analyst.md +1 -1
- package/presets/zcode/php-laravel/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/php-laravel/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/php-laravel/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/php-laravel/rules/feature-delivery-workflow.md +4 -0
- package/presets/zcode/svelte/adapter-map.json +1 -1
- package/presets/zcode/svelte/agents/task-analyst.md +1 -1
- package/presets/zcode/svelte/hooks/chain-team-phases.sh +9 -2
- package/presets/zcode/svelte/hooks/list-ai-local.mjs +17 -0
- package/presets/zcode/svelte/rules/agent-team-orchestrator.md +3 -1
- package/presets/zcode/svelte/rules/feature-delivery-workflow.md +4 -0
- package/scripts/report-context-cost.mjs +432 -0
- package/presets/_shared/ai-local/scripts/upstream-research.mjs +0 -2964
- package/presets/claude/next/commands/upstream-research.md +0 -23
- package/presets/claude/next/team/upstream/config.json +0 -31
- package/presets/claude/next/team/upstream/digest-template.md +0 -55
- package/presets/claude/next/team/upstream/jobs.json +0 -34
- package/presets/claude/next/team/upstream/opencode.json +0 -34
- package/presets/claude/next/team/upstream/projects.json +0 -4
- package/presets/claude/next/team/upstream/prompt.md +0 -77
- package/presets/claude/next/team/upstream/signatures.json +0 -9
- package/presets/cursor/next/commands/upstream-research.md +0 -23
- package/presets/cursor/next/team/upstream/config.json +0 -31
- package/presets/cursor/next/team/upstream/digest-template.md +0 -55
- package/presets/cursor/next/team/upstream/jobs.json +0 -34
- package/presets/cursor/next/team/upstream/opencode.json +0 -34
- package/presets/cursor/next/team/upstream/projects.json +0 -4
- package/presets/cursor/next/team/upstream/prompt.md +0 -77
- package/presets/cursor/next/team/upstream/signatures.json +0 -9
- package/presets/mavis/next/commands/upstream-research.md +0 -18
- package/presets/mavis/next/team/upstream/config.json +0 -31
- package/presets/mavis/next/team/upstream/digest-template.md +0 -55
- package/presets/mavis/next/team/upstream/jobs.json +0 -34
- package/presets/mavis/next/team/upstream/opencode.json +0 -34
- package/presets/mavis/next/team/upstream/projects.json +0 -4
- package/presets/mavis/next/team/upstream/prompt.md +0 -77
- package/presets/mavis/next/team/upstream/signatures.json +0 -9
- package/presets/opencode/next/commands/upstream-research.md +0 -26
- package/presets/opencode/next/team/upstream/config.json +0 -31
- package/presets/opencode/next/team/upstream/digest-template.md +0 -55
- package/presets/opencode/next/team/upstream/jobs.json +0 -34
- package/presets/opencode/next/team/upstream/opencode.json +0 -34
- package/presets/opencode/next/team/upstream/projects.json +0 -4
- package/presets/opencode/next/team/upstream/prompt.md +0 -77
- package/presets/opencode/next/team/upstream/signatures.json +0 -9
- package/presets/zcode/next/commands/upstream-research.md +0 -26
- package/presets/zcode/next/team/upstream/config.json +0 -31
- package/presets/zcode/next/team/upstream/digest-template.md +0 -55
- package/presets/zcode/next/team/upstream/jobs.json +0 -34
- package/presets/zcode/next/team/upstream/opencode.json +0 -34
- package/presets/zcode/next/team/upstream/projects.json +0 -4
- package/presets/zcode/next/team/upstream/prompt.md +0 -77
- package/presets/zcode/next/team/upstream/signatures.json +0 -9
|
@@ -151,7 +151,7 @@ Replanning is a **named, auditable operation** — never a silent reorder. Trigg
|
|
|
151
151
|
|
|
152
152
|
## Context budget & checkpoint/resume
|
|
153
153
|
|
|
154
|
-
Work in bounded waves (one artifact class across the target surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record the produced paths on the `implementation` manifest entry (`authoritativePaths`). That checkpoint is the hook `writeStatus` path: it rewrites `.ai.local/team/tasks/<slug>/focus.md`. `focus.md` is a view, not the system of record. It lists slug, pipeline step index, authoritative paths for incomplete manifest ids, the last `.memlog.md` `event:` line, the next gate, one decomposition ready-set line, and one archive index line, and it stays under 100 lines. `status.json`, `metrics.json`, `artifact-manifest.json`, and `.memlog.md` stay the system of record. A resumed run (`/task-continue`) reads `focus.md` first, then `artifact-manifest.json` and `.memlog.md`, and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. A completed manifest entry keeps id, status, and `authoritativePaths`, and the default resume read omits that entry's markdown body; closing it appends one new `.memlog.md` event: line, moves the bulky body to `.ai.local/team/tasks/<slug>/archive/YYYY-MM-DD/`, and leaves earlier memlog lines, the human-readable slug and artifact ids, and the manifest entry in place, with no Beads hash ids and no Taskmaster tags. Mechanical waves (generation, embed sync) are delegated to repo scripts. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. See **context-and-iteration** for the budget, checkpoint, resume, and refinement loop.
|
|
154
|
+
Work in bounded waves (one artifact class across the target surface). **Checkpoint** each completed wave to `.memlog.md` (`## <date>` + an `event:` line) and record the produced paths on the `implementation` manifest entry (`authoritativePaths`). That checkpoint is the hook `writeStatus` path: it rewrites `.ai.local/team/tasks/<slug>/focus.md`. `focus.md` is a view, not the system of record. It lists slug, pipeline step index, authoritative paths for incomplete manifest ids, the last `.memlog.md` `event:` line, the next gate, one decomposition ready-set line, and one archive index line, and it stays under 100 lines. `status.json`, `metrics.json`, `artifact-manifest.json`, and `.memlog.md` stay the system of record. A resumed run (`/task-continue`) reads `focus.md` first, then `artifact-manifest.json` and `.memlog.md`, and continues at the first stage whose exit criteria are unmet — never re-derive state from the chat. A completed manifest entry keeps id, status, and `authoritativePaths`, and the default resume read omits that entry's markdown body; closing it appends one new `.memlog.md` event: line, moves the bulky body to `.ai.local/team/tasks/<slug>/archive/YYYY-MM-DD/`, and leaves earlier memlog lines, the human-readable slug and artifact ids, and the manifest entry in place, with no Beads hash ids and no Taskmaster tags. Mechanical waves (generation, embed sync) are delegated to repo scripts. A large command output (log, diff, test run, `git log`) is piped through `.ai.local/scripts/dump-output.mjs` instead of being read whole: take its ≤40-line head, then `grep -n` the stored file or find it with `team-db.mjs search "<term>"`. An **interrupted producer** (tool abort, killed session) is resumed, not restarted: run the stack's compile gate on the working tree first, and when it is red hand the failing output to the same producer with a `fix and finish` brief instead of starting a second parallel attempt. When the host runtime writes no `status.json` (manual-hook hosts such as OpenCode), the resume checkpoint is `artifact-manifest.json` + `.memlog.md`; never gate a resume on a file the runtime does not produce. See **context-and-iteration** for the budget, checkpoint, resume, and refinement loop.
|
|
155
155
|
|
|
156
156
|
## Self-review & context hygiene
|
|
157
157
|
|
|
@@ -218,6 +218,8 @@ Additional states: `blocked` — a step (or a parallel producer) cannot proceed;
|
|
|
218
218
|
|
|
219
219
|
On each `subagentStop`, the hook reconciles `status.state` from the completing producer's terminal `artifact-manifest.json` receipt (`completed` \| `changes_requested` \| `validation_failed`) when agents left lifecycle fields untouched. Parent orchestrators must wait for that handoff before invoking the next step.
|
|
220
220
|
|
|
221
|
+
**A dispatch is not a completion.** When the host hands back a session handle, a job id, or control before the specialist's turn ends, the step is still open: do not dispatch the next step, do not report the step done, and do not run the chain hook until the specialist reports back and the hook records the receipt. A background handle is a start signal only.
|
|
222
|
+
|
|
221
223
|
## Pipeline step options
|
|
222
224
|
|
|
223
225
|
| Field | Use |
|
|
@@ -14,6 +14,10 @@ Typical feature with data and UI. Concrete directories and rule stems — in the
|
|
|
14
14
|
6. **Tests** — unit for mappers / non-trivial logic; e2e/UI per stack convention.
|
|
15
15
|
7. **Completion** — stack post-change gate (lint/build) + package/toolchain rules. When the current WP spans **more than one** layer or module, `implementation.md` includes a **Code Map** (3–8 annotated repo-relative paths) and **Suggested Review Order** (`concern | path:line | ≤15 word note`). Omit both for a single-file or single-layer WP.
|
|
16
16
|
|
|
17
|
+
## Context hygiene
|
|
18
|
+
|
|
19
|
+
A command whose output can exceed ~4 KB — a test run, a build/lint log, `git log`, a diff — is piped through `.ai.local/scripts/dump-output.mjs --task <slug>` instead of being read whole. Work from its ≤40-line head and the stored file (grep it or use `team-db.mjs search`), and when that output informed a decision, record the repo-relative `outputs/…` path in `implementation.md` or `validation-report.md`; a `code-reviewer` may ask for that path. Do not read the whole output into context.
|
|
20
|
+
|
|
17
21
|
## Iterative refinement loop
|
|
18
22
|
|
|
19
23
|
Every stage runs the named loop **draft → evaluate against named criteria → refine**:
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Output guard (OpenCode server plugin)
|
|
2
|
+
|
|
3
|
+
Keeps a large tool result out of the model's context window. The plugin registers
|
|
4
|
+
`ctx.session.hook("context")`, which receives the assembled messages before
|
|
5
|
+
dispatch. A `tool-result` over the threshold is written to
|
|
6
|
+
`.ai.local/team/output-guard/<sessionID>/outputs/` and replaced with a bounded
|
|
7
|
+
head + tail, the path, and one `grep` / `sed` hint. The change affects only the
|
|
8
|
+
outgoing model call; persisted history is untouched.
|
|
9
|
+
|
|
10
|
+
## Behaviour
|
|
11
|
+
|
|
12
|
+
| Item | Value |
|
|
13
|
+
|---|---|
|
|
14
|
+
| Trigger | `tool-result` text over **8192 B** (`AI_RULES_OUTPUT_GUARD_BYTES`) |
|
|
15
|
+
| Tools | `shell`, `bash`, `read`, `grep`, `glob`, `webfetch` |
|
|
16
|
+
| Replacement | 40-line / 2 KB head + 15-line / 1 KB tail + path + hints |
|
|
17
|
+
| Saved file | `.ai.local/team/output-guard/<sessionID>/outputs/<callID>-<tool>.txt`, 2 MiB cap |
|
|
18
|
+
| Stats | `.ai.local/team/output-guard/stats.jsonl` (one row per replacement) |
|
|
19
|
+
| Kill switch | `AI_RULES_OUTPUT_GUARD=0` |
|
|
20
|
+
| Debug | `AI_RULES_OUTPUT_GUARD_DEBUG=1` → `output-guard/debug.log` |
|
|
21
|
+
| Host | OpenCode V2 with `ctx.session.hook`; a host without it no-ops |
|
|
22
|
+
|
|
23
|
+
The replacement keeps the first and last lines because a test log often carries
|
|
24
|
+
the failure at the end. A JSON-looking result is still replaced, with a
|
|
25
|
+
`[json: full document at the path]` note so the agent can `jq` the file.
|
|
26
|
+
|
|
27
|
+
## Why a hook, not a rule
|
|
28
|
+
|
|
29
|
+
A prose line asks the agent to pipe output; context-mode measured that path at
|
|
30
|
+
0/20 routing. The hook runs after the tool has produced the result and before the
|
|
31
|
+
model sees it, so it holds for every prompt, including one without `/task`. The
|
|
32
|
+
trade-off: the model loses the middle of the output and must search the file.
|
|
33
|
+
|
|
34
|
+
## Files
|
|
35
|
+
|
|
36
|
+
- `index.ts` — host adapter: `Plugin.define`, team-root walk, writer, stats.
|
|
37
|
+
- `rewrite.ts` — pure `rewriteMessages`; no host imports, fixture-tested.
|
|
38
|
+
- `package.json` — local plugin package (`exports` → `index.ts`).
|
|
39
|
+
|
|
40
|
+
## Not a security boundary
|
|
41
|
+
|
|
42
|
+
The plugin writes under the project's `.ai.local/team/` and does not sandbox
|
|
43
|
+
anything. It is a token-economy mechanism, not an access control.
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode output guard: keeps a large tool result out of the context window.
|
|
3
|
+
*
|
|
4
|
+
* The `context` hook receives the assembled model messages before dispatch.
|
|
5
|
+
* A `tool-result` over the threshold is written to
|
|
6
|
+
* `.ai.local/team/output-guard/<session>/outputs/` and replaced with a bounded
|
|
7
|
+
* head + tail plus the path and one search hint. Nothing is persisted: the
|
|
8
|
+
* mutation affects only the outgoing call, so the next request rebuilds from
|
|
9
|
+
* the stored history.
|
|
10
|
+
*
|
|
11
|
+
* Kill switch: AI_RULES_OUTPUT_GUARD=0. Threshold:
|
|
12
|
+
* AI_RULES_OUTPUT_GUARD_BYTES (default 8192). Debug:
|
|
13
|
+
* AI_RULES_OUTPUT_GUARD_DEBUG=1.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import fs from "node:fs"
|
|
17
|
+
import path from "node:path"
|
|
18
|
+
import { Plugin } from "@opencode/plugin"
|
|
19
|
+
import { rewriteMessages } from "./rewrite.ts"
|
|
20
|
+
|
|
21
|
+
const MARKER = "[ai-rules output-guard]"
|
|
22
|
+
const DEFAULT_THRESHOLD_BYTES = 8192
|
|
23
|
+
const MAX_SAVED_BYTES = 2 * 1024 * 1024
|
|
24
|
+
const HEAD_BYTES = 2048
|
|
25
|
+
const TAIL_BYTES = 1024
|
|
26
|
+
const HEAD_LINES = 40
|
|
27
|
+
const TAIL_LINES = 15
|
|
28
|
+
const ALLOWLIST = new Set(["shell", "bash", "read", "grep", "glob", "webfetch"])
|
|
29
|
+
|
|
30
|
+
const findTeamRoot = (start: string): string | null => {
|
|
31
|
+
let dir = path.resolve(start)
|
|
32
|
+
for (;;) {
|
|
33
|
+
const candidate = path.join(dir, ".ai.local", "team")
|
|
34
|
+
try {
|
|
35
|
+
if (fs.statSync(candidate).isDirectory()) return candidate
|
|
36
|
+
} catch {
|
|
37
|
+
/* keep walking up */
|
|
38
|
+
}
|
|
39
|
+
const parent = path.dirname(dir)
|
|
40
|
+
if (parent === dir) return null
|
|
41
|
+
dir = parent
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const safeSegment = (value: string, fallback: string): string => {
|
|
46
|
+
const cleaned = value
|
|
47
|
+
.toLowerCase()
|
|
48
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
49
|
+
.replace(/^-+|-+$/g, "")
|
|
50
|
+
return cleaned.slice(0, 48) || fallback
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const writeOutput = ({
|
|
54
|
+
outputDir,
|
|
55
|
+
projectRoot,
|
|
56
|
+
sessionID,
|
|
57
|
+
tool,
|
|
58
|
+
id,
|
|
59
|
+
text,
|
|
60
|
+
}: {
|
|
61
|
+
outputDir: string
|
|
62
|
+
projectRoot: string
|
|
63
|
+
sessionID: string
|
|
64
|
+
tool: string
|
|
65
|
+
id: string
|
|
66
|
+
text: string
|
|
67
|
+
}): string | null => {
|
|
68
|
+
const session = safeSegment(sessionID, "session")
|
|
69
|
+
const dir = path.join(outputDir, session, "outputs")
|
|
70
|
+
fs.mkdirSync(dir, { recursive: true })
|
|
71
|
+
|
|
72
|
+
const base = `${safeSegment(id, "result")}-${safeSegment(tool, "tool")}`
|
|
73
|
+
const file = path.join(dir, `${base}.txt`)
|
|
74
|
+
const relative = path.relative(dir, file)
|
|
75
|
+
if (relative.startsWith("..") || path.isAbsolute(relative)) return null
|
|
76
|
+
|
|
77
|
+
const buffer = Buffer.from(text, "utf8").subarray(0, MAX_SAVED_BYTES)
|
|
78
|
+
const tmp = path.join(dir, `.${base}.tmp-${process.pid}-${Date.now()}`)
|
|
79
|
+
try {
|
|
80
|
+
fs.writeFileSync(tmp, buffer)
|
|
81
|
+
fs.renameSync(tmp, file)
|
|
82
|
+
} finally {
|
|
83
|
+
try {
|
|
84
|
+
fs.rmSync(tmp, { force: true })
|
|
85
|
+
} catch {
|
|
86
|
+
/* best effort */
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const shown = path.relative(projectRoot, file)
|
|
91
|
+
const inside = shown !== "" && !shown.startsWith("..") && !path.isAbsolute(shown)
|
|
92
|
+
return (inside ? shown : file).split(path.sep).join("/")
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const appendJsonl = (dir: string, name: string, row: unknown) => {
|
|
96
|
+
try {
|
|
97
|
+
fs.mkdirSync(dir, { recursive: true })
|
|
98
|
+
fs.appendFileSync(path.join(dir, name), `${JSON.stringify(row)}\n`)
|
|
99
|
+
} catch {
|
|
100
|
+
/* the guard must never break the session */
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const readNumber = (name: string, fallback: number): number => {
|
|
105
|
+
const raw = process.env[name]
|
|
106
|
+
if (!raw) return fallback
|
|
107
|
+
const value = Number(raw)
|
|
108
|
+
return Number.isFinite(value) && value > 0 ? Math.floor(value) : fallback
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
type ToolItem = {
|
|
112
|
+
type?: string
|
|
113
|
+
id?: string
|
|
114
|
+
name?: string
|
|
115
|
+
input?: unknown
|
|
116
|
+
result?: { type?: string; value?: unknown }
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const commandOf = (input: unknown): string => {
|
|
120
|
+
if (!input || typeof input !== "object") return ""
|
|
121
|
+
const record = input as Record<string, unknown>
|
|
122
|
+
for (const key of ["command", "filePath", "path", "pattern", "url", "query"]) {
|
|
123
|
+
const value = record[key]
|
|
124
|
+
if (typeof value === "string" && value !== "") return value.slice(0, 200)
|
|
125
|
+
}
|
|
126
|
+
return ""
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Pair tool calls with their results once per assembled request. The pair gives
|
|
131
|
+
* the command for the category report; the raw bytes are the stored output, not
|
|
132
|
+
* the bounded replacement from a previous request.
|
|
133
|
+
*/
|
|
134
|
+
const collectToolActivity = (messages: unknown) => {
|
|
135
|
+
const calls = new Map<string, { tool: string; command: string }>()
|
|
136
|
+
const results: Array<{ id: string; tool: string; rawBytes: number }> = []
|
|
137
|
+
if (!Array.isArray(messages)) return { calls, results }
|
|
138
|
+
for (const message of messages as Array<{ content?: unknown }>) {
|
|
139
|
+
const content = message?.content
|
|
140
|
+
if (!Array.isArray(content)) continue
|
|
141
|
+
for (const item of content as ToolItem[]) {
|
|
142
|
+
if (item?.type === "tool-call" && typeof item.id === "string") {
|
|
143
|
+
calls.set(item.id, {
|
|
144
|
+
tool: typeof item.name === "string" ? item.name : "",
|
|
145
|
+
command: commandOf(item.input),
|
|
146
|
+
})
|
|
147
|
+
}
|
|
148
|
+
if (
|
|
149
|
+
item?.type === "tool-result" &&
|
|
150
|
+
typeof item.id === "string" &&
|
|
151
|
+
item.result?.type === "text" &&
|
|
152
|
+
typeof item.result.value === "string"
|
|
153
|
+
) {
|
|
154
|
+
const call = calls.get(item.id)
|
|
155
|
+
results.push({
|
|
156
|
+
id: item.id,
|
|
157
|
+
tool: call?.tool ?? (typeof item.name === "string" ? item.name : ""),
|
|
158
|
+
rawBytes: Buffer.byteLength(item.result.value, "utf8"),
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return { calls, results }
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export default Plugin.define({
|
|
167
|
+
id: "ai-rules.output-guard",
|
|
168
|
+
async setup(ctx) {
|
|
169
|
+
try {
|
|
170
|
+
if (process.env.AI_RULES_OUTPUT_GUARD === "0") return
|
|
171
|
+
if (typeof ctx.session?.hook !== "function") return
|
|
172
|
+
const root = findTeamRoot(ctx.location.directory)
|
|
173
|
+
if (!root) return
|
|
174
|
+
|
|
175
|
+
const options = {
|
|
176
|
+
thresholdBytes: readNumber("AI_RULES_OUTPUT_GUARD_BYTES", DEFAULT_THRESHOLD_BYTES),
|
|
177
|
+
headBytes: HEAD_BYTES,
|
|
178
|
+
tailBytes: TAIL_BYTES,
|
|
179
|
+
headLines: HEAD_LINES,
|
|
180
|
+
tailLines: TAIL_LINES,
|
|
181
|
+
allowlist: ALLOWLIST,
|
|
182
|
+
marker: MARKER,
|
|
183
|
+
}
|
|
184
|
+
const outputDir = process.env.AI_RULES_OUTPUT_GUARD_DIR
|
|
185
|
+
? path.resolve(process.env.AI_RULES_OUTPUT_GUARD_DIR)
|
|
186
|
+
: path.join(root, "output-guard")
|
|
187
|
+
const projectRoot = path.resolve(root, "..", "..")
|
|
188
|
+
const savedPaths = new Map<string, string>()
|
|
189
|
+
const statsRecorded = new Set<string>()
|
|
190
|
+
const resultsSeen = new Set<string>()
|
|
191
|
+
const usageSeen = new Set<string>()
|
|
192
|
+
|
|
193
|
+
const recordUsage = async (sessionID: string) => {
|
|
194
|
+
try {
|
|
195
|
+
const messages = await ctx.session.context({ sessionID })
|
|
196
|
+
if (!Array.isArray(messages)) return
|
|
197
|
+
for (const message of messages as Array<{
|
|
198
|
+
id?: unknown
|
|
199
|
+
agent?: unknown
|
|
200
|
+
model?: unknown
|
|
201
|
+
tokens?: {
|
|
202
|
+
input?: unknown
|
|
203
|
+
output?: unknown
|
|
204
|
+
reasoning?: unknown
|
|
205
|
+
cache?: { read?: unknown; write?: unknown }
|
|
206
|
+
}
|
|
207
|
+
cost?: unknown
|
|
208
|
+
finish?: unknown
|
|
209
|
+
}>) {
|
|
210
|
+
const id = typeof message?.id === "string" ? message.id : ""
|
|
211
|
+
const tokens = message?.tokens
|
|
212
|
+
if (id === "" || !tokens || typeof tokens.input !== "number") continue
|
|
213
|
+
const key = `${sessionID}|${id}`
|
|
214
|
+
if (usageSeen.has(key)) continue
|
|
215
|
+
usageSeen.add(key)
|
|
216
|
+
appendJsonl(outputDir, "usage.jsonl", {
|
|
217
|
+
at: new Date().toISOString(),
|
|
218
|
+
sessionID,
|
|
219
|
+
messageID: id,
|
|
220
|
+
agent: typeof message.agent === "string" ? message.agent : "",
|
|
221
|
+
model: message.model ?? null,
|
|
222
|
+
input: tokens.input,
|
|
223
|
+
output: typeof tokens.output === "number" ? tokens.output : 0,
|
|
224
|
+
reasoning: typeof tokens.reasoning === "number" ? tokens.reasoning : 0,
|
|
225
|
+
cacheRead: typeof tokens.cache?.read === "number" ? tokens.cache.read : 0,
|
|
226
|
+
cacheWrite: typeof tokens.cache?.write === "number" ? tokens.cache.write : 0,
|
|
227
|
+
cost: typeof message.cost === "number" ? message.cost : 0,
|
|
228
|
+
finish: typeof message.finish === "string" ? message.finish : "",
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
} catch {
|
|
232
|
+
/* fail open: usage is an observation, not a guard input */
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
await ctx.session.hook("context", async (event) => {
|
|
237
|
+
try {
|
|
238
|
+
const sessionID = typeof event.sessionID === "string" ? event.sessionID : "session"
|
|
239
|
+
await recordUsage(sessionID)
|
|
240
|
+
const { calls, results } = collectToolActivity(event.messages)
|
|
241
|
+
const save = ({ tool, id, text }: { tool: string; id: string; text: string }) => {
|
|
242
|
+
const key = `${sessionID}|${id}|${tool}`
|
|
243
|
+
const existing = savedPaths.get(key)
|
|
244
|
+
if (existing) return existing
|
|
245
|
+
const file = writeOutput({ outputDir, projectRoot, sessionID, tool, id, text })
|
|
246
|
+
if (file) savedPaths.set(key, file)
|
|
247
|
+
return file
|
|
248
|
+
}
|
|
249
|
+
const result = rewriteMessages(event.messages, options, save)
|
|
250
|
+
const changedById = new Map(result.changed.map((stat) => [stat.id, stat]))
|
|
251
|
+
for (const stat of result.changed) {
|
|
252
|
+
if (statsRecorded.has(stat.path)) continue
|
|
253
|
+
statsRecorded.add(stat.path)
|
|
254
|
+
appendJsonl(outputDir, "stats.jsonl", {
|
|
255
|
+
at: new Date().toISOString(),
|
|
256
|
+
sessionID,
|
|
257
|
+
callID: stat.id,
|
|
258
|
+
tool: stat.tool,
|
|
259
|
+
beforeBytes: stat.beforeBytes,
|
|
260
|
+
afterBytes: stat.afterBytes,
|
|
261
|
+
path: stat.path,
|
|
262
|
+
})
|
|
263
|
+
}
|
|
264
|
+
for (const item of results) {
|
|
265
|
+
const key = `${sessionID}|${item.id}`
|
|
266
|
+
if (resultsSeen.has(key)) continue
|
|
267
|
+
resultsSeen.add(key)
|
|
268
|
+
const changed = changedById.get(item.id)
|
|
269
|
+
appendJsonl(outputDir, "results.jsonl", {
|
|
270
|
+
at: new Date().toISOString(),
|
|
271
|
+
sessionID,
|
|
272
|
+
callID: item.id,
|
|
273
|
+
tool: item.tool,
|
|
274
|
+
command: calls.get(item.id)?.command ?? "",
|
|
275
|
+
rawBytes: item.rawBytes,
|
|
276
|
+
returnedBytes: changed ? changed.afterBytes : item.rawBytes,
|
|
277
|
+
replaced: changed !== undefined,
|
|
278
|
+
path: changed?.path ?? "",
|
|
279
|
+
})
|
|
280
|
+
}
|
|
281
|
+
} catch (error) {
|
|
282
|
+
if (process.env.AI_RULES_OUTPUT_GUARD_DEBUG === "1") {
|
|
283
|
+
appendJsonl(outputDir, "debug.log", {
|
|
284
|
+
at: new Date().toISOString(),
|
|
285
|
+
message: error instanceof Error ? error.message : String(error),
|
|
286
|
+
})
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
})
|
|
290
|
+
} catch (error) {
|
|
291
|
+
if (process.env.AI_RULES_OUTPUT_GUARD_DEBUG === "1") {
|
|
292
|
+
appendJsonl(
|
|
293
|
+
path.join(ctx.location.directory, ".ai.local", "team", "output-guard"),
|
|
294
|
+
"debug.log",
|
|
295
|
+
{ at: new Date().toISOString(), message: error instanceof Error ? error.message : String(error) },
|
|
296
|
+
)
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
})
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure replacement logic for the OpenCode output guard. No host imports: the
|
|
3
|
+
* adapter in `index.ts` supplies the writer, and the fixture test imports this
|
|
4
|
+
* module directly.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type OutputGuardOptions = {
|
|
8
|
+
thresholdBytes: number
|
|
9
|
+
headBytes: number
|
|
10
|
+
tailBytes: number
|
|
11
|
+
headLines: number
|
|
12
|
+
tailLines: number
|
|
13
|
+
allowlist: ReadonlySet<string>
|
|
14
|
+
marker: string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type SaveOutputInput = { tool: string; id: string; text: string }
|
|
18
|
+
|
|
19
|
+
export type SaveOutput = (input: SaveOutputInput) => string | null
|
|
20
|
+
|
|
21
|
+
export type OutputGuardStats = {
|
|
22
|
+
id: string
|
|
23
|
+
tool: string
|
|
24
|
+
beforeBytes: number
|
|
25
|
+
afterBytes: number
|
|
26
|
+
path: string
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type RewriteResult = { changed: OutputGuardStats[] }
|
|
30
|
+
|
|
31
|
+
type ToolResult = {
|
|
32
|
+
type?: string
|
|
33
|
+
name?: string
|
|
34
|
+
id?: string
|
|
35
|
+
result?: { type?: string; value?: unknown }
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type Message = { role?: string; content?: unknown }
|
|
39
|
+
|
|
40
|
+
const DEFAULT_MARKER = "[ai-rules output-guard]"
|
|
41
|
+
|
|
42
|
+
export const isOutputGuardText = (value: string, marker = DEFAULT_MARKER): boolean =>
|
|
43
|
+
value.startsWith(marker)
|
|
44
|
+
|
|
45
|
+
const bytes = (value: string): number => Buffer.byteLength(value, "utf8")
|
|
46
|
+
|
|
47
|
+
const takeHead = (value: string, maxBytes: number, maxLines: number): string => {
|
|
48
|
+
const lines = value.split("\n").slice(0, maxLines)
|
|
49
|
+
let text = lines.join("\n")
|
|
50
|
+
if (bytes(text) > maxBytes) {
|
|
51
|
+
text = Buffer.from(text, "utf8").subarray(0, maxBytes).toString("utf8")
|
|
52
|
+
}
|
|
53
|
+
return text
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const takeTail = (value: string, maxBytes: number, maxLines: number): string => {
|
|
57
|
+
const lines = value.split("\n")
|
|
58
|
+
let text = lines.slice(Math.max(0, lines.length - maxLines)).join("\n")
|
|
59
|
+
if (bytes(text) > maxBytes) {
|
|
60
|
+
const buffer = Buffer.from(text, "utf8")
|
|
61
|
+
text = buffer.subarray(Math.max(0, buffer.length - maxBytes)).toString("utf8")
|
|
62
|
+
}
|
|
63
|
+
return text
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** A search term a shell can carry inside single quotes. */
|
|
67
|
+
const SEARCH_TERM = /^[\p{L}\p{N}][\p{L}\p{N}_-]*$/u
|
|
68
|
+
|
|
69
|
+
const searchTerm = (head: string, fallback: string): string => {
|
|
70
|
+
for (const line of head.split("\n")) {
|
|
71
|
+
for (const token of line.split(/\s+/)) {
|
|
72
|
+
if (token.length >= 2 && SEARCH_TERM.test(token)) return token.slice(0, 64)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return fallback
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const looksJson = (value: string): boolean => /^[\s]*[{[]/.test(value)
|
|
79
|
+
|
|
80
|
+
export const renderReplacement = (
|
|
81
|
+
value: string,
|
|
82
|
+
file: string,
|
|
83
|
+
options: OutputGuardOptions,
|
|
84
|
+
): string => {
|
|
85
|
+
const head = takeHead(value, options.headBytes, options.headLines)
|
|
86
|
+
const tail = takeTail(value, options.tailBytes, options.tailLines)
|
|
87
|
+
const term = searchTerm(head, "error")
|
|
88
|
+
const total = bytes(value)
|
|
89
|
+
const json = looksJson(value) ? " [json: full document at the path]" : ""
|
|
90
|
+
return [
|
|
91
|
+
`${options.marker} ${total} B -> bounded head+tail${json}`,
|
|
92
|
+
head,
|
|
93
|
+
"... (truncated)",
|
|
94
|
+
tail,
|
|
95
|
+
`${options.marker} full output: ${file} (${total} B)`,
|
|
96
|
+
`${options.marker} search: grep -n '${term}' ${file}`,
|
|
97
|
+
`${options.marker} read more: sed -n '${options.headLines + 1},${options.headLines + 80}p' ${file}`,
|
|
98
|
+
].join("\n")
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Replace every large, allow-listed `tool-result` text in the assembled model
|
|
103
|
+
* messages. Mutates the result objects in place (the host assembles them per
|
|
104
|
+
* request) and returns the stats the adapter records.
|
|
105
|
+
*/
|
|
106
|
+
export function rewriteMessages(
|
|
107
|
+
messages: unknown,
|
|
108
|
+
options: OutputGuardOptions,
|
|
109
|
+
save: SaveOutput,
|
|
110
|
+
): RewriteResult {
|
|
111
|
+
const changed: OutputGuardStats[] = []
|
|
112
|
+
if (!Array.isArray(messages)) return { changed }
|
|
113
|
+
|
|
114
|
+
for (const message of messages as Message[]) {
|
|
115
|
+
const content = message?.content
|
|
116
|
+
if (!Array.isArray(content)) continue
|
|
117
|
+
for (const item of content as ToolResult[]) {
|
|
118
|
+
if (item?.type !== "tool-result") continue
|
|
119
|
+
const tool = typeof item.name === "string" ? item.name : ""
|
|
120
|
+
if (tool === "" || !options.allowlist.has(tool)) continue
|
|
121
|
+
const result = item.result
|
|
122
|
+
if (result?.type !== "text" || typeof result.value !== "string") continue
|
|
123
|
+
const value = result.value
|
|
124
|
+
if (isOutputGuardText(value, options.marker)) continue
|
|
125
|
+
const beforeBytes = bytes(value)
|
|
126
|
+
if (beforeBytes <= options.thresholdBytes) continue
|
|
127
|
+
|
|
128
|
+
let file: string | null = null
|
|
129
|
+
try {
|
|
130
|
+
file = save({ tool, id: typeof item.id === "string" ? item.id : "", text: value })
|
|
131
|
+
} catch {
|
|
132
|
+
continue
|
|
133
|
+
}
|
|
134
|
+
if (file === null || file === "") continue
|
|
135
|
+
|
|
136
|
+
const replacement = renderReplacement(value, file, options)
|
|
137
|
+
result.value = replacement
|
|
138
|
+
changed.push({
|
|
139
|
+
id: typeof item.id === "string" ? item.id : "",
|
|
140
|
+
tool,
|
|
141
|
+
beforeBytes,
|
|
142
|
+
afterBytes: bytes(replacement),
|
|
143
|
+
path: file,
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return { changed }
|
|
149
|
+
}
|
|
@@ -8,10 +8,10 @@ Modelled on the built-in MCP sidebar plugin (`packages/tui/src/feature-plugins/s
|
|
|
8
8
|
|
|
9
9
|
- header `▼ Task` toggles on click; collapsed it reads `▶ Task (running · 3/7 · 16h 05m)`
|
|
10
10
|
- each row is a flex row of a bold label and a value; the state value is colored by tone (success, warning, error, muted)
|
|
11
|
-
- the step row carries a progress bar, e.g. `3/7 ███░░░░░ · attempt 1 · 3h 35m`
|
|
12
|
-
- the `eta` row reads `~52m · p90 3h 32m`: estimated time to finish the remaining plan steps. It
|
|
13
|
-
- clicking any row opens a details dialog with 3-cell side padding: `goal.md`, pipeline steps with the current one marked,
|
|
14
|
-
- a live task shows `■ stop` in the header; click → confirm → writes `.ai.local/STOP
|
|
11
|
+
- the step row carries a progress bar, e.g. `3/7 ███░░░░░ · attempt 1 · 3h 35m`; a `status.json` written before any attempt reads `3/7 · no attempt started` instead of hiding the plan
|
|
12
|
+
- the `eta` row reads `~52m · p90 3h 32m`: estimated time to finish the remaining plan steps. It hides while the run waits on a human gate, is paused, blocked, waiting for a receipt, or is done. A stale run keeps it — the estimate is historical, not live — and with fewer than 3 ledgers the row reads `—` instead of disappearing
|
|
13
|
+
- clicking any row opens a details dialog with 3-cell side padding: `goal.md`, pipeline steps with the current one marked, artifacts from `artifact-manifest.json`, the last manifest entries, the prompt, the last update age and the ETA with its ledger count. The body scrolls with ↑/↓, PgUp/PgDn, Home/End or the mouse wheel; `esc` closes it.
|
|
14
|
+
- a live task shows `■ stop` in the header; click → confirm → writes the task-scoped `.ai.local/team/tasks/<slug>/STOP` (the repo-wide `.ai.local/STOP` only when the task directory is gone). The in-flight attempt finishes, no next step starts. A task with a stop sentinel shows `▶ resume` instead: confirm clears it. Saying `/task-continue <slug>` (or `продолжай` / `continue`) in a matched session is the keyboard path. <!-- i18n-keep: E4 -->
|
|
15
15
|
- a stale task reads `◌ stale · 8d 17h ago` with a muted tone instead of pretending to run
|
|
16
16
|
- the open flag lives in `context.storage.store("panel", { initial: { open: true } })`, so it survives restarts; the live view stays in `context.storage.memory`
|
|
17
17
|
- values use `wrapMode="none" truncate` and `minWidth={0}`, so a narrow sidebar truncates instead of wrapping
|
|
@@ -24,6 +24,7 @@ Reads the nearest `.ai.local/team/` above the session directory:
|
|
|
24
24
|
- `tasks/<slug>/status.json` — state, attempts, gate, timestamps
|
|
25
25
|
- `tasks/<slug>/pipeline.json` — step count and the agent for each remaining step
|
|
26
26
|
- `tasks/<slug>/metrics.json` — task start, role per attempt, attempt durations
|
|
27
|
+
- `tasks/<slug>/artifact-manifest.json` — producer receipts that feed the details dialog
|
|
27
28
|
- every `tasks/*/metrics.json` — historical attempt durations that feed the ETA medians
|
|
28
29
|
|
|
29
30
|
## ETA
|
|
@@ -36,6 +37,7 @@ Reads the nearest `.ai.local/team/` above the session directory:
|
|
|
36
37
|
- `p90` is `max(4 × p50, 1.5 × √Σ p90²)` — the quadrature keeps the range from growing linearly with the step count
|
|
37
38
|
- a parallel step (`agent: [...]` or `parallel: true`) takes the slowest agent, not the sum
|
|
38
39
|
- fewer than 3 ledgers with finished attempts → no estimate
|
|
40
|
+
- the details dialog prints the ledger count next to the estimate, so a `—` is explained instead of looking broken
|
|
39
41
|
|
|
40
42
|
Calibrated on this repository's 66 ledgers: 52% of tasks finish below the p50 and 89% below the p90 when estimated before the first step; after half the steps, 47% and 87%.
|
|
41
43
|
|
|
@@ -43,9 +45,10 @@ The number excludes human gates and ignores parallelism between steps, so the ac
|
|
|
43
45
|
|
|
44
46
|
## Session mapping
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
The sidebar renders the session the host passes into the `sidebar.content` slot (`input.sessionID`), not the router's current route: with session tabs the route and the visible sidebar can differ. The router is only a fallback when the slot input is empty. Every tick the plugin reads that session's user messages (`client.message.list`, `type=user`, oldest first, up to five pages) and matches them against the prompt index:
|
|
47
49
|
|
|
48
|
-
- an exact
|
|
50
|
+
- an exact match wins; otherwise the longest substring match of at least 24 characters maps the tab to that task, and recency breaks ties
|
|
51
|
+
- the match is memoized per prompt-index generation and message fingerprint, so the one-second tick does not re-scan every prompt
|
|
49
52
|
- a `/task-continue <slug>` message maps the tab directly to that slug
|
|
50
53
|
- a subagent session maps through `data.session.root(sessionID)`, so its sidebar shows the parent task
|
|
51
54
|
- no match → `prompt <session title>` and `state no task`; an `Untitled session` title falls back to the first user message
|
|
@@ -53,6 +56,8 @@ Every tick the plugin reads the active route's session and its user messages (`c
|
|
|
53
56
|
|
|
54
57
|
Session messages refresh every 5s and the prompt index every 30s, so a `/task` tab picks up its task as soon as the agent writes `prompt.md`. The old global `active-task.json` pointer is no longer used for selection; it only helps locate the team root.
|
|
55
58
|
|
|
59
|
+
Set `OPENCODE_TASK_STATUS_DEBUG=1` before starting the TUI to append one line per tick to `<tmpdir>/ai-rules-task-status-debug.log`: the slot and route session IDs when they change, then the session, message count, matched slug, and rendered summary. The flag never changes what the sidebar shows.
|
|
60
|
+
|
|
56
61
|
## Install
|
|
57
62
|
|
|
58
63
|
Shipped with `@bonesofspring/ai-rules` for every OpenCode preset. `ai-rules init opencode`
|
|
@@ -68,10 +73,16 @@ No build, no dependencies:
|
|
|
68
73
|
|
|
69
74
|
- `index.ts` — no-op server part. The TUI part loads with the plugin package; a TUI-only
|
|
70
75
|
package would belong in the global `cli.json` instead.
|
|
71
|
-
- `tui.tsx` — slot registration, rows, expand/collapse and the details dialog trigger.
|
|
76
|
+
- `tui.tsx` — slot registration, rows, expand/collapse, stop/resume and the details dialog trigger.
|
|
72
77
|
- `task-view.ts` — session mapping, file polling, view model.
|
|
78
|
+
- `types.ts` — shared status/pipeline/manifest/view types.
|
|
79
|
+
- `prompt-text.ts` — the single `prompt.md` parser used by the view and the dialog.
|
|
80
|
+
- `format.ts` — duration/age/ETA formatting.
|
|
81
|
+
- `eta.ts` — the estimate itself.
|
|
73
82
|
- `details.tsx`, `details-data.ts` — the row-click dialog and its file readers.
|
|
74
83
|
|
|
84
|
+
Relative imports carry explicit `.ts` / `.tsx` extensions. A local plugin directory resolves files rather than the package `exports` map, and an extensionless import of a `.tsx` sibling is skipped by the loader without a message.
|
|
85
|
+
|
|
75
86
|
Do not import `solid-js` here. A local plugin resolves its own copy, and signals created by that copy are not tracked by the host renderer, so the UI renders once and never updates. Reactive state goes through `context.storage.memory`, refreshed once per second.
|
|
76
87
|
|
|
77
88
|
## Update
|
|
@@ -79,14 +90,15 @@ Do not import `solid-js` here. A local plugin resolves its own copy, and signals
|
|
|
79
90
|
`ai-rules update` refreshes the installed copy. In a development checkout, edit the
|
|
80
91
|
preset source and re-run the installer, or copy the changed files into
|
|
81
92
|
`.opencode/plugins/task-status/`. The loader watches the server entrypoint (`index.ts`),
|
|
82
|
-
so an edit to
|
|
83
|
-
|
|
93
|
+
so an edit to any plugin module needs `/reload` (or `opencode reload`) to be picked up.
|
|
94
|
+
The sidebar is session-scoped and follows `session.sidebar.toggle` (`ctrl+x b`).
|
|
84
95
|
|
|
85
96
|
## Limits
|
|
86
97
|
|
|
87
|
-
- The stop
|
|
98
|
+
- The stop button writes the task-scoped `tasks/<slug>/STOP`; the repo-wide `.ai.local/STOP` is the fallback when that directory is gone and remains the operator's own pause, so it blocks new steps for every task.
|
|
99
|
+
- The resume intent clears a sentinel only when the session maps to a task; a bare `дальше` (continue) in an unrelated session no longer releases a repo-wide pause. <!-- i18n-keep: E4 -->
|
|
88
100
|
- Mapping relies on prompt text: a task without `prompt.md` and `prompt-log.md` cannot be matched, so its tab falls back to the prompt view.
|
|
89
|
-
- With a remote server, messages come from the server but the prompt files are read from the client filesystem.
|
|
101
|
+
- With a remote server, messages come from the server but the prompt files are read from the client filesystem; a failed message fetch keeps the last view and marks it `offline` for a minute.
|
|
90
102
|
- `status.json` timestamps are the only clock: a task paused for days shows total wall time plus a `stale` marker.
|
|
91
103
|
- A timestamp later than the host clock is ignored; a future `task_started` in agent-written metrics would otherwise freeze the elapsed value at `0s`.
|
|
92
104
|
- The ETA has no per-repository model: the medians are shared by every task under the team root, so a run that differs in size from the history is only as good as the step composition and the profile. It also needs finished attempts — a first run in a fresh repository shows no estimate.
|