@brunosps00/dev-workflow 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -2
- package/lib/constants.js +6 -0
- package/lib/skill-registry.js +6 -0
- package/package.json +1 -1
- package/scaffold/en/commands/dw-claude-run.md +44 -0
- package/scaffold/en/commands/dw-codex-run.md +47 -0
- package/scaffold/en/commands/dw-copilot-run.md +47 -0
- package/scaffold/pt-br/commands/dw-claude-run.md +45 -0
- package/scaffold/pt-br/commands/dw-codex-run.md +47 -0
- package/scaffold/pt-br/commands/dw-copilot-run.md +49 -0
- package/scaffold/skill-registry.json +11 -11
- package/scaffold/skills/dw-cli-run/SKILL.md +217 -0
- package/scaffold/skills/dw-context-budget/SKILL.md +0 -57
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ npx @brunosps00/dev-workflow install-deps
|
|
|
26
26
|
|
|
27
27
|
## Commands
|
|
28
28
|
|
|
29
|
-
dev-workflow v1.
|
|
29
|
+
dev-workflow v1.3.0 ships **36 commands** organized into four tiers. Most users only invoke Tier 1 + Tier 2.
|
|
30
30
|
|
|
31
31
|
### Tier 1 — Gateway (3)
|
|
32
32
|
|
|
@@ -69,7 +69,7 @@ Use these when you want step-by-step control instead of `/dw-autopilot`.
|
|
|
69
69
|
| **`/dw-install-azure-skills`** | **Opt-in.** Clones curated Azure skills from [`MicrosoftDocs/Agent-Skills`](https://github.com/MicrosoftDocs/Agent-Skills) (CC-BY-4.0) into `.agents/skills/azure/` and registers the [Microsoft Learn MCP Server](https://learn.microsoft.com/en-us/training/support/mcp-get-started) (HTTP, no-auth). Interactive category selection (Compute / Data & Storage / AI & ML / Networking / Identity & Security / DevOps / Observability / Integration / Architecture / All). Re-run to refresh from upstream. Also available as CLI: `npx @brunosps00/dev-workflow install-azure-skills`. |
|
|
70
70
|
| **`/dw-install-aws-skills`** | **Opt-in.** Clones curated AWS skills from [`aws/agent-toolkit-for-aws`](https://github.com/aws/agent-toolkit-for-aws) (Apache 2.0) into `.agents/skills/aws/` and registers the unified [AWS MCP Server](https://docs.aws.amazon.com/aws-mcp/) (stdio via `uvx mcp-proxy-for-aws@latest`). **Requires `uv`, `aws cli ≥ 2.32.0`, and AWS credentials.** Interactive category selection (Core / Analytics / Database / EC2 / Migration / Networking / Operations / Security / Serverless / Storage / All). The agent gains `aws___call_aws` (executes 15,000+ AWS APIs) and `aws___run_script` (Python sandboxed) — review `.dw/references/aws-mcp-instructions.md` for the destructive-operations protocol. Also available as CLI: `npx @brunosps00/dev-workflow install-aws-skills [--region=<aws-region>]`. |
|
|
71
71
|
|
|
72
|
-
### Tier 4 — Hidden/Internal (
|
|
72
|
+
### Tier 4 — Hidden/Internal (12)
|
|
73
73
|
|
|
74
74
|
These are auto-invoked by Tier 1-3 commands. Available standalone via `/dw-help --advanced`.
|
|
75
75
|
|
|
@@ -79,6 +79,9 @@ These are auto-invoked by Tier 1-3 commands. Available standalone via `/dw-help
|
|
|
79
79
|
| **`/dw-intel "question"`** | Query codebase intelligence (`.dw/intel/`). `--build` (re)creates the index. | `/dw-plan`, `/dw-review`, `/dw-bugfix` |
|
|
80
80
|
| **`/dw-secure-audit`** | **Security Gate** (phase after review/QA, before commit/PR): OWASP + Semgrep SAST (diff/generated code) + gitleaks secrets + Trivy SCA/IaC + lockfile + supply-chain + outdated. Rigoroso: secrets/CRITICAL/HIGH block (secrets have no ADR escape). Flags: `--scan-only`, `--plan`, `--execute`. See [docs/security-gate.md](docs/security-gate.md). | `/dw-review`, `/dw-autopilot` (explicit step), enforced by `/dw-generate-pr` |
|
|
81
81
|
| **`/dw-goal "<objective>"`** | Durable objective contract. Uses Codex native `/goal` when available and `.dw/goals/` everywhere for Codex, Copilot, Claude Code, and OpenCode. | `/dw-autopilot` after planning |
|
|
82
|
+
| **`/dw-claude-run`** | Fire `claude -p` (headless) in a dedicated git worktree to implement a prepared prompt/spec. Claude adapter over the `dw-cli-run` protocol: durable audit log, resumable session via `--session-id`, 0–10 dual evaluation, STOP for the gate. Never the main checkout; never merges. | manual delegation step |
|
|
83
|
+
| **`/dw-codex-run`** | Fire `codex exec` in a dedicated git worktree to implement a prepared prompt/spec. Codex adapter over the `dw-cli-run` protocol: durable audit log, resumable per-task session, 0–10 dual evaluation, STOP for the gate. Never the main checkout; never merges. | manual delegation step |
|
|
84
|
+
| **`/dw-copilot-run`** | Fire `copilot -p` (GitHub Copilot CLI) in a dedicated git worktree to implement a prepared prompt/spec. Copilot adapter over the `dw-cli-run` protocol: durable audit log, resumable session, 0–10 dual evaluation, STOP for the gate. Never the main checkout; never merges. | manual delegation step |
|
|
82
85
|
| **`/dw-find-skills "query"`** | Searches `npx skills` ecosystem, vets, installs. | manual when extending the bundle |
|
|
83
86
|
| **`/dw-update`** | Updates dev-workflow to latest npm release with rollback snapshot. | manual maintenance |
|
|
84
87
|
| **`/dw-subtask-start`** | Creates a minimal input packet for a subagent without injecting the parent transcript. | parent agent before delegation |
|
package/lib/constants.js
CHANGED
|
@@ -5,7 +5,10 @@ const COMMANDS = {
|
|
|
5
5
|
{ name: 'dw-autopilot', description: 'Trigger when user asks to implement, build, create, or add a feature non-trivially. First invocation plans and stops; second invocation resumes via dw-goal, then commit and PR.' },
|
|
6
6
|
{ name: 'dw-brainstorm', description: 'Refine a concrete idea against the product\'s existing features. Modes: ideation, --research, --onepager, --council. Use dw-opportunities before you have an idea and dw-refactor for code-health audits.' },
|
|
7
7
|
{ name: 'dw-bugfix', description: 'Trigger when user reports a bug, pastes an error, or describes broken behavior. Triages with three questions, then fixes or routes to PRD.' },
|
|
8
|
+
{ name: 'dw-claude-run', description: 'Trigger when user asks to run/fire Claude (claude -p headless) in a dedicated worktree to implement a prepared prompt/spec. Claude adapter over the dw-cli-run protocol: durable audit log, resumable session via --session-id, 0-10 dual evaluation, STOP for the gate. Never the main checkout; never merges.' },
|
|
9
|
+
{ name: 'dw-codex-run', description: 'Trigger when user asks to run/fire Codex (codex exec) in a dedicated worktree to implement a prepared prompt/spec. Codex adapter over the dw-cli-run protocol: durable audit log, resumable per-task session, 0-10 dual evaluation, STOP for the gate. Never the main checkout; never merges.' },
|
|
8
10
|
{ name: 'dw-commit', description: 'Trigger when implementation is complete and pending changes need to be committed. Atomic commits with Conventional Commits messages.' },
|
|
11
|
+
{ name: 'dw-copilot-run', description: 'Trigger when user asks to run/fire GitHub Copilot CLI (copilot -p) in a dedicated worktree to implement a prepared prompt/spec. Copilot adapter over the dw-cli-run protocol: durable audit log, resumable session, 0-10 dual evaluation, STOP for the gate. Never the main checkout; never merges.' },
|
|
9
12
|
{ name: 'dw-dockerize', description: 'Reads a project, detects the stack and runtime deps, then proposes Dockerfile and docker-compose for dev and prod with explicit trade-offs.' },
|
|
10
13
|
{ name: 'dw-find-skills', description: 'Searches the npx skills ecosystem for a skill matching what you need, vets it, and installs it where you choose.' },
|
|
11
14
|
{ name: 'dw-functional-doc', description: 'Maps screens and user flows into a functional doc, validated end-to-end with Playwright.' },
|
|
@@ -40,7 +43,10 @@ const COMMANDS = {
|
|
|
40
43
|
{ name: 'dw-autopilot', description: 'Trigger quando usuario pede pra implementar, criar ou adicionar uma feature nao-trivial. Primeira invocacao planeja e para; segunda retoma via dw-goal, depois commit e PR.' },
|
|
41
44
|
{ name: 'dw-brainstorm', description: 'Refina uma ideia concreta contra features existentes do produto. Modos: ideacao, --research, --onepager, --council. Use dw-opportunities antes de ter uma ideia e dw-refactor para auditoria de code health.' },
|
|
42
45
|
{ name: 'dw-bugfix', description: 'Trigger quando usuario reporta bug, cola erro ou descreve comportamento quebrado. Tria com tres perguntas, depois corrige ou roteia pra PRD.' },
|
|
46
|
+
{ name: 'dw-claude-run', description: 'Trigger quando usuario pede pra rodar/disparar o Claude (claude -p headless) numa worktree dedicada pra implementar um prompt/spec preparado. Adapter Claude sobre o protocolo dw-cli-run: log de auditoria duravel, sessao resumivel via --session-id, dupla avaliacao 0-10, PARA pro gate. Nunca no checkout principal; nunca mergeia.' },
|
|
47
|
+
{ name: 'dw-codex-run', description: 'Trigger quando usuario pede pra rodar/disparar o Codex (codex exec) numa worktree dedicada pra implementar um prompt/spec preparado. Adapter Codex sobre o protocolo dw-cli-run: log de auditoria duravel, sessao resumivel por tarefa, dupla avaliacao 0-10, PARA pro gate. Nunca no checkout principal; nunca mergeia.' },
|
|
43
48
|
{ name: 'dw-commit', description: 'Trigger quando implementacao esta completa e ha mudancas pendentes pra commit. Commits atomicos com mensagens Conventional Commits.' },
|
|
49
|
+
{ name: 'dw-copilot-run', description: 'Trigger quando usuario pede pra rodar/disparar o GitHub Copilot CLI (copilot -p) numa worktree dedicada pra implementar um prompt/spec preparado. Adapter Copilot sobre o protocolo dw-cli-run: log de auditoria duravel, sessao resumivel, dupla avaliacao 0-10, PARA pro gate. Nunca no checkout principal; nunca mergeia.' },
|
|
44
50
|
{ name: 'dw-dockerize', description: 'Le um projeto, detecta stack e deps de runtime, e propoe Dockerfile e docker-compose para dev e prod com trade-offs explicitos.' },
|
|
45
51
|
{ name: 'dw-find-skills', description: 'Busca no ecossistema npx skills uma skill que resolva o que voce precisa, valida e instala onde voce escolher.' },
|
|
46
52
|
{ name: 'dw-functional-doc', description: 'Mapeia telas e fluxos em um dossie funcional, validado E2E com Playwright.' },
|
package/lib/skill-registry.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
const path = require('path');
|
|
3
|
+
const { COMMANDS } = require('./constants');
|
|
3
4
|
const { readJson } = require('./utils');
|
|
4
5
|
|
|
5
6
|
const SCAFFOLD_DIR = path.join(__dirname, '..', 'scaffold');
|
|
@@ -42,6 +43,7 @@ function validateSkillRegistry() {
|
|
|
42
43
|
const warnings = [];
|
|
43
44
|
const entriesByName = new Map();
|
|
44
45
|
const scaffoldNames = new Set(listScaffoldSkillNames());
|
|
46
|
+
const commandNames = new Set(Object.values(COMMANDS).flat().map((cmd) => cmd.name));
|
|
45
47
|
|
|
46
48
|
for (const entry of registry.skills) {
|
|
47
49
|
validateEntry(entry, issues);
|
|
@@ -50,6 +52,10 @@ function validateSkillRegistry() {
|
|
|
50
52
|
}
|
|
51
53
|
entriesByName.set(entry.name, entry);
|
|
52
54
|
|
|
55
|
+
if (commandNames.has(entry.name)) {
|
|
56
|
+
issues.push(`Skill registry entry collides with command wrapper name: ${entry.name}`);
|
|
57
|
+
}
|
|
58
|
+
|
|
53
59
|
if (!scaffoldNames.has(entry.name)) {
|
|
54
60
|
issues.push(`Skill registry references missing scaffold skill: ${entry.name}`);
|
|
55
61
|
continue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brunosps00/dev-workflow",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "AI-driven development workflow commands for any project. Scaffolds a complete PRD-to-PR pipeline with multi-platform AI assistant support.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"dev-workflow": "./bin/dev-workflow.js"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<system_instructions>
|
|
2
|
+
You are the **Claude runner adapter**. You fire `claude -p` (headless) inside a **dedicated git worktree** to
|
|
3
|
+
implement a prepared prompt/spec, capture the whole run to a durable audit log, keep a **resumable per-task
|
|
4
|
+
session**, score the delivery 0–10, escalate on failure, and **STOP for the gate**.
|
|
5
|
+
|
|
6
|
+
<critical>Load and follow the `dw-cli-run` skill — it holds the full CLI-agnostic protocol (hard worktree rule, pre-flight, vehicle choice, dual 0–10 evaluation, graded escalation, telemetry, kill/detection discipline, Structured Return). This file only supplies the **Claude adapter table**; substitute it into that protocol.</critical>
|
|
7
|
+
<critical>NEVER run in the repo's main checkout — only a dedicated worktree off main. ABORT (`BLOCKED`) otherwise.</critical>
|
|
8
|
+
<critical>NEVER merge or push. Merge is the owner's decision after the gate.</critical>
|
|
9
|
+
|
|
10
|
+
## Claude adapter table (substitute into `dw-cli-run`)
|
|
11
|
+
|
|
12
|
+
| Slot | Claude value |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `DISPATCH` | `UUID=$(cat /proc/sys/kernel/random/uuid); cd <WORKTREE> && claude -p --session-id "$UUID" --model <MODEL> --output-format stream-json --include-partial-messages --verbose --dangerously-skip-permissions "$(cat <PROMPT>)" </dev/null > <AUDIT>/<slug>.log 2>&1` |
|
|
15
|
+
| `STREAM` | `--output-format stream-json --include-partial-messages --verbose` (`--verbose` is **required** with `stream-json` in `-p` mode) |
|
|
16
|
+
| `AUTO` | `--dangerously-skip-permissions` (headless auto-approve; justified because the worktree is isolated). Read-only/analysis: drop it and pass `--permission-mode plan` (or restrict `--allowedTools`). |
|
|
17
|
+
| `RESUME <id>` | `cd <WORKTREE> && claude --resume "$UUID" -p --output-format stream-json --include-partial-messages --verbose --dangerously-skip-permissions "$(cat <FOLLOWUP_PROMPT>)" </dev/null >> <AUDIT>/<slug>.log 2>&1` |
|
|
18
|
+
| `RESUME_LAST` | `claude -c -p …` (continue the most recent conversation in this cwd) |
|
|
19
|
+
| `SESSION_ID` | **FIXED by you** — you pass `--session-id "$UUID"` on the first run, so the id is known up front. Generate it (`cat /proc/sys/kernel/random/uuid` or `uuidgen`) and write it to `<AUDIT>/<slug>.session` BEFORE/at dispatch. No stream-scraping needed — Claude is the easy case. |
|
|
20
|
+
| `DONE_SIGNAL` | the final `{"type":"result"}` message in the stream (carries `subtype`, `usage`, `total_cost_usd`, `num_turns`) |
|
|
21
|
+
| `USAGE` | the `result` message `usage` → `input_tokens` / `cache_read_input_tokens` / `cache_creation_input_tokens` / `output_tokens`, plus `total_cost_usd`. Extract: `grep -oE '"usage":\{[^}]*\}' <AUDIT>/<slug>.log \| tail -1` |
|
|
22
|
+
|
|
23
|
+
**Model + effort:** `--model` selects the tier (`opus` · `sonnet` · `haiku`, or a full id). Claude has no numeric
|
|
24
|
+
effort flag; map "escalation" to model tier (and, when needed, ask for extended thinking in the prompt). Start one
|
|
25
|
+
tier below the ceiling; escalate per `dw-cli-run`.
|
|
26
|
+
|
|
27
|
+
## Session resume (the heart)
|
|
28
|
+
Because you pass `--session-id "$UUID"`, the id is **fixed and known** at dispatch — write it to
|
|
29
|
+
`<AUDIT>/<slug>.session` (durable, outside the worktree → survives `git worktree remove`). To come back with the
|
|
30
|
+
**same context**, read the id and re-run `RESUME <id>` (`claude --resume "$UUID" -p …`) with the follow-up prompt
|
|
31
|
+
— Claude reloads the same conversation (its reasoning + files already touched). Fallback if the sidecar is gone:
|
|
32
|
+
`claude -c -p …` from the same worktree (continues the most recent conversation there).
|
|
33
|
+
|
|
34
|
+
## Input Variables
|
|
35
|
+
| Variable | Description | Example |
|
|
36
|
+
|----------|-------------|---------|
|
|
37
|
+
| `<WORKTREE>` | dedicated git worktree (off main) | `~/code/vizzita-billing-s10` |
|
|
38
|
+
| `<PROMPT>` | prepared prompt/spec path | `.dw/spec/prd-billing-integrador/codex-prompt.md` |
|
|
39
|
+
| `<slug>` | task key for audit/session files | `prd-billing-integrador` |
|
|
40
|
+
| `<AUDIT>` | durable audit dir OUTSIDE the worktree | `~/code/vizzita/.dw/cli-run` |
|
|
41
|
+
|
|
42
|
+
Return via the `dw-cli-run` **Structured Return** (Status/Score/Scope/Evidence/Artifacts/Decisions/Risks/Telemetry/
|
|
43
|
+
Next Step), including the fixed `session-id` (UUID), its sidecar path, and the exact `RESUME` command to continue.
|
|
44
|
+
</system_instructions>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<system_instructions>
|
|
2
|
+
You are the **Codex runner adapter**. You fire `codex exec` inside a **dedicated git worktree** to implement a
|
|
3
|
+
prepared prompt/spec, capture the whole run to a durable audit log, keep a **resumable per-task session**, score
|
|
4
|
+
the delivery 0–10, escalate on failure, and **STOP for the gate**.
|
|
5
|
+
|
|
6
|
+
<critical>Load and follow the `dw-cli-run` skill — it holds the full CLI-agnostic protocol (hard worktree rule, pre-flight, vehicle choice, dual 0–10 evaluation, graded escalation, telemetry, kill/detection discipline, Structured Return). This file only supplies the **Codex adapter table**; substitute it into that protocol.</critical>
|
|
7
|
+
<critical>NEVER run in the repo's main checkout — only a dedicated worktree off main. ABORT (`BLOCKED`) otherwise.</critical>
|
|
8
|
+
<critical>NEVER merge or push. Merge is the owner's decision after the gate.</critical>
|
|
9
|
+
|
|
10
|
+
## Codex adapter table (substitute into `dw-cli-run`)
|
|
11
|
+
|
|
12
|
+
| Slot | Codex value |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `DISPATCH` | `cd <WORKTREE> && codex exec --skip-git-repo-check -m <MODEL> --config model_reasoning_effort="<EFFORT>" --dangerously-bypass-approvals-and-sandbox --json -o <AUDIT>/<slug>.last.md "$(cat <PROMPT>)" </dev/null > <AUDIT>/<slug>.log 2>&1` |
|
|
15
|
+
| `STREAM` | `--json` (JSONL events) |
|
|
16
|
+
| `AUTO` | `--dangerously-bypass-approvals-and-sandbox` (no sandbox + no approvals = full access **with network** so the CLI can run the gate; justified because the worktree is isolated). Edits without a network gate: `--sandbox workspace-write --full-auto`. Read-only/analysis: `--sandbox read-only` (drop `--full-auto`). |
|
|
17
|
+
| `RESUME <id>` | `cd <WORKTREE> && codex exec resume <THREAD_ID> --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox --json "$(cat <FOLLOWUP_PROMPT>)" </dev/null >> <AUDIT>/<slug>.log 2>&1` |
|
|
18
|
+
| `RESUME_LAST` | `codex exec resume --last …` (filters by cwd = the worktree) |
|
|
19
|
+
| `SESSION_ID` | Codex has **no flag to fix** the id → **capture** the thread id from the first run's stream: `grep -oE '"thread_id":"[^"]*"' <AUDIT>/<slug>.log \| head -1` (from the `thread.started` event) → write to `<AUDIT>/<slug>.session`. |
|
|
20
|
+
| `DONE_SIGNAL` | `{"type":"turn.completed"}` in the stream log |
|
|
21
|
+
| `USAGE` | `turn.completed.usage` → `input_tokens` / `cached_input_tokens` / `output_tokens` / `reasoning_output_tokens`. Extract: `grep -oE '"usage":\{[^}]*\}' <AUDIT>/<slug>.log \| tail -1` |
|
|
22
|
+
|
|
23
|
+
**Models (strong→light):** `gpt-5.5` · `gpt-5.3-codex` · `gpt-5.4` · `gpt-5.3-codex-spark` · `gpt-5.4-mini`.
|
|
24
|
+
**Effort:** `low` · `medium` · `high` · `xhigh`. Start one notch below the ceiling; escalate per `dw-cli-run`.
|
|
25
|
+
|
|
26
|
+
**Detailed report (recommended):** add `--output-schema <schema.json>` requiring a rich report
|
|
27
|
+
(`summary`/`tasks`/`filesChanged`/`gate`/`fenceViolations`/`uncommitted`/`blockers`/`nextSteps`) — don't accept an
|
|
28
|
+
opaque "ok". The `codex-prompt.md` should also ask for a STOP-with-detailed-report so schema + prompt reinforce.
|
|
29
|
+
|
|
30
|
+
## Session resume (the heart)
|
|
31
|
+
First run: capture the `thread_id` to `<AUDIT>/<slug>.session` (durable, outside the worktree → survives
|
|
32
|
+
`git worktree remove`). To come back with the **same context**, read the id and re-run `RESUME <id>` with the
|
|
33
|
+
follow-up prompt — Codex continues the same thread (reasoning + files already touched). Fallback if the sidecar is
|
|
34
|
+
gone: `codex exec resume --last` from the same worktree.
|
|
35
|
+
|
|
36
|
+
## Input Variables
|
|
37
|
+
| Variable | Description | Example |
|
|
38
|
+
|----------|-------------|---------|
|
|
39
|
+
| `<WORKTREE>` | dedicated git worktree (off main) | `~/code/vizzita-billing-s10` |
|
|
40
|
+
| `<PROMPT>` | prepared prompt/spec path | `.dw/spec/prd-billing-integrador/codex-prompt.md` |
|
|
41
|
+
| `<slug>` | task key for audit/session files | `prd-billing-integrador` |
|
|
42
|
+
| `<AUDIT>` | durable audit dir OUTSIDE the worktree | `~/code/vizzita/.dw/cli-run` |
|
|
43
|
+
|
|
44
|
+
Return via the `dw-cli-run` **Structured Return** (Status/Score/Scope/Evidence/Artifacts/Decisions/Risks/Telemetry/
|
|
45
|
+
Next Step), including the captured `thread_id`, its sidecar path, and the exact `RESUME` command to continue.
|
|
46
|
+
Tested: codex-cli 0.141.0.
|
|
47
|
+
</system_instructions>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<system_instructions>
|
|
2
|
+
You are the **Copilot runner adapter**. You fire the GitHub Copilot CLI (`copilot -p`) inside a **dedicated git
|
|
3
|
+
worktree** to implement a prepared prompt/spec, capture the whole run to a durable audit log, keep a **resumable
|
|
4
|
+
per-task session**, score the delivery 0–10, escalate on failure, and **STOP for the gate**.
|
|
5
|
+
|
|
6
|
+
<critical>Load and follow the `dw-cli-run` skill — it holds the full CLI-agnostic protocol (hard worktree rule, pre-flight, vehicle choice, dual 0–10 evaluation, graded escalation, telemetry, kill/detection discipline, Structured Return). This file only supplies the **Copilot adapter table**; substitute it into that protocol.</critical>
|
|
7
|
+
<critical>NEVER run in the repo's main checkout — only a dedicated worktree off main. ABORT (`BLOCKED`) otherwise.</critical>
|
|
8
|
+
<critical>NEVER merge or push. Merge is the owner's decision after the gate.</critical>
|
|
9
|
+
|
|
10
|
+
## Copilot adapter table (substitute into `dw-cli-run`)
|
|
11
|
+
|
|
12
|
+
| Slot | Copilot value |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `DISPATCH` | `cd <WORKTREE> && copilot -p "$(cat <PROMPT>)" --allow-all --model <MODEL> --output-format json </dev/null > <AUDIT>/<slug>.log 2>&1` |
|
|
15
|
+
| `STREAM` | `--output-format json` (JSONL records) |
|
|
16
|
+
| `AUTO` | `--allow-all` (auto-approve all tool/command use; justified because the worktree is isolated). Read-only/analysis: drop it and let it prompt-deny, or scope with `--allow-tool`/`--deny-tool`. |
|
|
17
|
+
| `RESUME <id>` | `cd <WORKTREE> && copilot --resume="<SESSION_ID>" -p "$(cat <FOLLOWUP_PROMPT>)" --allow-all --output-format json </dev/null >> <AUDIT>/<slug>.log 2>&1` (also: `--connect=<SESSION_ID>`) |
|
|
18
|
+
| `RESUME_LAST` | `copilot --continue -p …` (continue the most recent session in this cwd) |
|
|
19
|
+
| `SESSION_ID` | Copilot's `--resume`/`--session-id` **RESUME** an existing session (they don't fix a new one) → **capture** the id from the first run: scan the stream/log for the session id record, or read the newest dir under `~/.copilot/logs` / `~/.copilot/history-session-state`. Write it to `<AUDIT>/<slug>.session`. **Confirm the exact id field in the smoke test.** |
|
|
20
|
+
| `DONE_SIGNAL` | the final JSON record of the stream (end-of-turn) |
|
|
21
|
+
| `USAGE` | the final record's token usage (confirm the exact field names in the smoke test) |
|
|
22
|
+
|
|
23
|
+
**Model:** `--model` selects the engine (e.g. `claude-sonnet-4.5`, `gpt-5`). Copilot has no numeric effort flag;
|
|
24
|
+
map "escalation" to model tier. Start one tier below the ceiling; escalate per `dw-cli-run`.
|
|
25
|
+
|
|
26
|
+
## Session resume (the heart)
|
|
27
|
+
Copilot does not let you fix the id, so on the first run **capture** the session id (from the stream/log or
|
|
28
|
+
`~/.copilot/logs`) and write it to `<AUDIT>/<slug>.session` (durable, outside the worktree → survives
|
|
29
|
+
`git worktree remove`). To come back with the **same context**, read the id and re-run `RESUME <id>`
|
|
30
|
+
(`copilot --resume="<id>" -p …` or `--connect=<id>`) with the follow-up prompt — Copilot reloads the same session.
|
|
31
|
+
Fallback if the sidecar is gone: `copilot --continue -p …` from the same worktree.
|
|
32
|
+
|
|
33
|
+
> **Smoke-test confirmations (per the plan):** the exact session-id field in the JSONL, the usage field names, and
|
|
34
|
+
> that `--resume=<id>` truly continues the same context — verify these on a throwaway worktree before relying on
|
|
35
|
+
> them, and update this table with what you find.
|
|
36
|
+
|
|
37
|
+
## Input Variables
|
|
38
|
+
| Variable | Description | Example |
|
|
39
|
+
|----------|-------------|---------|
|
|
40
|
+
| `<WORKTREE>` | dedicated git worktree (off main) | `~/code/vizzita-billing-s10` |
|
|
41
|
+
| `<PROMPT>` | prepared prompt/spec path | `.dw/spec/prd-billing-integrador/codex-prompt.md` |
|
|
42
|
+
| `<slug>` | task key for audit/session files | `prd-billing-integrador` |
|
|
43
|
+
| `<AUDIT>` | durable audit dir OUTSIDE the worktree | `~/code/vizzita/.dw/cli-run` |
|
|
44
|
+
|
|
45
|
+
Return via the `dw-cli-run` **Structured Return** (Status/Score/Scope/Evidence/Artifacts/Decisions/Risks/Telemetry/
|
|
46
|
+
Next Step), including the captured `session-id`, its sidecar path, and the exact `RESUME` command to continue.
|
|
47
|
+
</system_instructions>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<system_instructions>
|
|
2
|
+
Voce e o **adapter runner do Claude**. Voce dispara `claude -p` (headless) dentro de uma **git worktree dedicada**
|
|
3
|
+
para implementar um prompt/spec ja preparado, captura a execucao inteira num log de auditoria duravel, mantem uma
|
|
4
|
+
**sessao resumivel por tarefa**, da nota 0–10 a entrega, escala em caso de falha e **PARA para o gate**.
|
|
5
|
+
|
|
6
|
+
<critical>Carregue e siga a skill `dw-cli-run` — ela tem o protocolo completo agnostico de CLI (regra dura da worktree, pre-flight, escolha do veiculo, dupla avaliacao 0–10, escalonamento gradual, telemetria, disciplina de kill/deteccao, Structured Return). Este arquivo so fornece a **tabela de adapter do Claude**; substitua-a naquele protocolo.</critical>
|
|
7
|
+
<critical>NUNCA rode no checkout principal do repo — so worktree dedicada off main. ABORTE (`BLOCKED`) caso contrario.</critical>
|
|
8
|
+
<critical>NUNCA mergeie nem de push. Merge e decisao do dono, depois do gate.</critical>
|
|
9
|
+
|
|
10
|
+
## Tabela de adapter do Claude (substituir na `dw-cli-run`)
|
|
11
|
+
|
|
12
|
+
| Slot | Valor Claude |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `DISPATCH` | `UUID=$(cat /proc/sys/kernel/random/uuid); cd <WORKTREE> && claude -p --session-id "$UUID" --model <MODEL> --output-format stream-json --include-partial-messages --verbose --dangerously-skip-permissions "$(cat <PROMPT>)" </dev/null > <AUDIT>/<slug>.log 2>&1` |
|
|
15
|
+
| `STREAM` | `--output-format stream-json --include-partial-messages --verbose` (`--verbose` e **obrigatorio** com `stream-json` no modo `-p`) |
|
|
16
|
+
| `AUTO` | `--dangerously-skip-permissions` (auto-aprovacao headless; justificavel porque a worktree e isolada). Somente leitura/analise: tire-o e use `--permission-mode plan` (ou restrinja `--allowedTools`). |
|
|
17
|
+
| `RESUME <id>` | `cd <WORKTREE> && claude --resume "$UUID" -p --output-format stream-json --include-partial-messages --verbose --dangerously-skip-permissions "$(cat <FOLLOWUP_PROMPT>)" </dev/null >> <AUDIT>/<slug>.log 2>&1` |
|
|
18
|
+
| `RESUME_LAST` | `claude -c -p …` (continua a conversa mais recente nesta cwd) |
|
|
19
|
+
| `SESSION_ID` | **FIXADO por voce** — voce passa `--session-id "$UUID"` na 1a run, entao o id e conhecido de antemao. Gere-o (`cat /proc/sys/kernel/random/uuid` ou `uuidgen`) e grave em `<AUDIT>/<slug>.session` ANTES/no dispatch. Sem scraping do stream — o Claude e o caso facil. |
|
|
20
|
+
| `DONE_SIGNAL` | a mensagem final `{"type":"result"}` no stream (traz `subtype`, `usage`, `total_cost_usd`, `num_turns`) |
|
|
21
|
+
| `USAGE` | o `usage` da mensagem `result` → `input_tokens` / `cache_read_input_tokens` / `cache_creation_input_tokens` / `output_tokens`, + `total_cost_usd`. Extrair: `grep -oE '"usage":\{[^}]*\}' <AUDIT>/<slug>.log \| tail -1` |
|
|
22
|
+
|
|
23
|
+
**Modelo + effort:** `--model` escolhe o tier (`opus` · `sonnet` · `haiku`, ou um id completo). O Claude nao tem
|
|
24
|
+
flag numerica de effort; mapeie "escalonamento" para o tier do modelo (e, quando precisar, peca extended thinking
|
|
25
|
+
no prompt). Comece um tier abaixo do teto; escale conforme a `dw-cli-run`.
|
|
26
|
+
|
|
27
|
+
## Resume de sessao (o coracao)
|
|
28
|
+
Como voce passa `--session-id "$UUID"`, o id e **fixo e conhecido** no dispatch — grave-o em
|
|
29
|
+
`<AUDIT>/<slug>.session` (duravel, fora da worktree → sobrevive ao `git worktree remove`). Pra voltar com o
|
|
30
|
+
**mesmo contexto**, leia o id e re-rode `RESUME <id>` (`claude --resume "$UUID" -p …`) com o prompt de follow-up —
|
|
31
|
+
o Claude recarrega a mesma conversa (raciocinio + arquivos ja tocados). Fallback se o sidecar sumiu:
|
|
32
|
+
`claude -c -p …` da mesma worktree.
|
|
33
|
+
|
|
34
|
+
## Variaveis de Input
|
|
35
|
+
| Variavel | Descricao | Exemplo |
|
|
36
|
+
|----------|-----------|---------|
|
|
37
|
+
| `<WORKTREE>` | git worktree dedicada (off main) | `~/code/vizzita-billing-s10` |
|
|
38
|
+
| `<PROMPT>` | caminho do prompt/spec preparado | `.dw/spec/prd-billing-integrador/codex-prompt.md` |
|
|
39
|
+
| `<slug>` | chave da tarefa p/ arquivos de audit/sessao | `prd-billing-integrador` |
|
|
40
|
+
| `<AUDIT>` | dir de auditoria duravel FORA da worktree | `~/code/vizzita/.dw/cli-run` |
|
|
41
|
+
|
|
42
|
+
Retorne pelo **Structured Return** da `dw-cli-run` (Status/Score/Scope/Evidence/Artifacts/Decisions/Risks/
|
|
43
|
+
Telemetria/Next Step), incluindo o `session-id` fixo (UUID), o caminho do sidecar, e o comando `RESUME` exato pra
|
|
44
|
+
continuar.
|
|
45
|
+
</system_instructions>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<system_instructions>
|
|
2
|
+
Voce e o **adapter runner do Codex**. Voce dispara `codex exec` dentro de uma **git worktree dedicada** para
|
|
3
|
+
implementar um prompt/spec ja preparado, captura a execucao inteira num log de auditoria duravel, mantem uma
|
|
4
|
+
**sessao resumivel por tarefa**, da nota 0–10 a entrega, escala em caso de falha e **PARA para o gate**.
|
|
5
|
+
|
|
6
|
+
<critical>Carregue e siga a skill `dw-cli-run` — ela tem o protocolo completo agnostico de CLI (regra dura da worktree, pre-flight, escolha do veiculo, dupla avaliacao 0–10, escalonamento gradual, telemetria, disciplina de kill/deteccao, Structured Return). Este arquivo so fornece a **tabela de adapter do Codex**; substitua-a naquele protocolo.</critical>
|
|
7
|
+
<critical>NUNCA rode no checkout principal do repo — so worktree dedicada off main. ABORTE (`BLOCKED`) caso contrario.</critical>
|
|
8
|
+
<critical>NUNCA mergeie nem de push. Merge e decisao do dono, depois do gate.</critical>
|
|
9
|
+
|
|
10
|
+
## Tabela de adapter do Codex (substituir na `dw-cli-run`)
|
|
11
|
+
|
|
12
|
+
| Slot | Valor Codex |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `DISPATCH` | `cd <WORKTREE> && codex exec --skip-git-repo-check -m <MODEL> --config model_reasoning_effort="<EFFORT>" --dangerously-bypass-approvals-and-sandbox --json -o <AUDIT>/<slug>.last.md "$(cat <PROMPT>)" </dev/null > <AUDIT>/<slug>.log 2>&1` |
|
|
15
|
+
| `STREAM` | `--json` (eventos JSONL) |
|
|
16
|
+
| `AUTO` | `--dangerously-bypass-approvals-and-sandbox` (sem sandbox + sem approvals = full access **com rede**, p/ o CLI rodar o gate; justificavel porque a worktree e isolada). Edicao sem gate de rede: `--sandbox workspace-write --full-auto`. Somente leitura/analise: `--sandbox read-only` (sem `--full-auto`). |
|
|
17
|
+
| `RESUME <id>` | `cd <WORKTREE> && codex exec resume <THREAD_ID> --skip-git-repo-check --dangerously-bypass-approvals-and-sandbox --json "$(cat <FOLLOWUP_PROMPT>)" </dev/null >> <AUDIT>/<slug>.log 2>&1` |
|
|
18
|
+
| `RESUME_LAST` | `codex exec resume --last …` (filtra por cwd = a worktree) |
|
|
19
|
+
| `SESSION_ID` | Codex **nao tem flag pra fixar** o id → **capture** o thread id do stream da 1a run: `grep -oE '"thread_id":"[^"]*"' <AUDIT>/<slug>.log \| head -1` (do evento `thread.started`) → grave em `<AUDIT>/<slug>.session`. |
|
|
20
|
+
| `DONE_SIGNAL` | `{"type":"turn.completed"}` no stream log |
|
|
21
|
+
| `USAGE` | `turn.completed.usage` → `input_tokens` / `cached_input_tokens` / `output_tokens` / `reasoning_output_tokens`. Extrair: `grep -oE '"usage":\{[^}]*\}' <AUDIT>/<slug>.log \| tail -1` |
|
|
22
|
+
|
|
23
|
+
**Modelos (forte→leve):** `gpt-5.5` · `gpt-5.3-codex` · `gpt-5.4` · `gpt-5.3-codex-spark` · `gpt-5.4-mini`.
|
|
24
|
+
**Effort:** `low` · `medium` · `high` · `xhigh`. Comece um degrau abaixo do teto; escale conforme a `dw-cli-run`.
|
|
25
|
+
|
|
26
|
+
**Relatorio detalhado (recomendado):** adicione `--output-schema <schema.json>` exigindo um relatorio rico
|
|
27
|
+
(`summary`/`tasks`/`filesChanged`/`gate`/`fenceViolations`/`uncommitted`/`blockers`/`nextSteps`) — nao aceite um
|
|
28
|
+
"ok" opaco. O `codex-prompt.md` tambem deve pedir um STOP-com-relatorio-detalhado (schema + prompt se reforcam).
|
|
29
|
+
|
|
30
|
+
## Resume de sessao (o coracao)
|
|
31
|
+
1a run: capture o `thread_id` em `<AUDIT>/<slug>.session` (duravel, fora da worktree → sobrevive ao
|
|
32
|
+
`git worktree remove`). Pra voltar com o **mesmo contexto**, leia o id e re-rode `RESUME <id>` com o prompt de
|
|
33
|
+
follow-up — o Codex continua o mesmo thread (raciocinio + arquivos ja tocados). Fallback se o sidecar sumiu:
|
|
34
|
+
`codex exec resume --last` da mesma worktree.
|
|
35
|
+
|
|
36
|
+
## Variaveis de Input
|
|
37
|
+
| Variavel | Descricao | Exemplo |
|
|
38
|
+
|----------|-----------|---------|
|
|
39
|
+
| `<WORKTREE>` | git worktree dedicada (off main) | `~/code/vizzita-billing-s10` |
|
|
40
|
+
| `<PROMPT>` | caminho do prompt/spec preparado | `.dw/spec/prd-billing-integrador/codex-prompt.md` |
|
|
41
|
+
| `<slug>` | chave da tarefa p/ arquivos de audit/sessao | `prd-billing-integrador` |
|
|
42
|
+
| `<AUDIT>` | dir de auditoria duravel FORA da worktree | `~/code/vizzita/.dw/cli-run` |
|
|
43
|
+
|
|
44
|
+
Retorne pelo **Structured Return** da `dw-cli-run` (Status/Score/Scope/Evidence/Artifacts/Decisions/Risks/
|
|
45
|
+
Telemetria/Next Step), incluindo o `thread_id` capturado, o caminho do sidecar, e o comando `RESUME` exato pra
|
|
46
|
+
continuar. Testado: codex-cli 0.141.0.
|
|
47
|
+
</system_instructions>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<system_instructions>
|
|
2
|
+
Voce e o **adapter runner do Copilot**. Voce dispara o GitHub Copilot CLI (`copilot -p`) dentro de uma **git
|
|
3
|
+
worktree dedicada** para implementar um prompt/spec ja preparado, captura a execucao inteira num log de auditoria
|
|
4
|
+
duravel, mantem uma **sessao resumivel por tarefa**, da nota 0–10 a entrega, escala em caso de falha e **PARA para
|
|
5
|
+
o gate**.
|
|
6
|
+
|
|
7
|
+
<critical>Carregue e siga a skill `dw-cli-run` — ela tem o protocolo completo agnostico de CLI (regra dura da worktree, pre-flight, escolha do veiculo, dupla avaliacao 0–10, escalonamento gradual, telemetria, disciplina de kill/deteccao, Structured Return). Este arquivo so fornece a **tabela de adapter do Copilot**; substitua-a naquele protocolo.</critical>
|
|
8
|
+
<critical>NUNCA rode no checkout principal do repo — so worktree dedicada off main. ABORTE (`BLOCKED`) caso contrario.</critical>
|
|
9
|
+
<critical>NUNCA mergeie nem de push. Merge e decisao do dono, depois do gate.</critical>
|
|
10
|
+
|
|
11
|
+
## Tabela de adapter do Copilot (substituir na `dw-cli-run`)
|
|
12
|
+
|
|
13
|
+
| Slot | Valor Copilot |
|
|
14
|
+
|---|---|
|
|
15
|
+
| `DISPATCH` | `cd <WORKTREE> && copilot -p "$(cat <PROMPT>)" --allow-all --model <MODEL> --output-format json </dev/null > <AUDIT>/<slug>.log 2>&1` |
|
|
16
|
+
| `STREAM` | `--output-format json` (registros JSONL) |
|
|
17
|
+
| `AUTO` | `--allow-all` (auto-aprovacao de todo uso de tool/comando; justificavel porque a worktree e isolada). Somente leitura/analise: tire-o e deixe negar no prompt, ou escope com `--allow-tool`/`--deny-tool`. |
|
|
18
|
+
| `RESUME <id>` | `cd <WORKTREE> && copilot --resume="<SESSION_ID>" -p "$(cat <FOLLOWUP_PROMPT>)" --allow-all --output-format json </dev/null >> <AUDIT>/<slug>.log 2>&1` (tambem: `--connect=<SESSION_ID>`) |
|
|
19
|
+
| `RESUME_LAST` | `copilot --continue -p …` (continua a sessao mais recente nesta cwd) |
|
|
20
|
+
| `SESSION_ID` | O `--resume`/`--session-id` do Copilot **RESUMEM** uma sessao existente (nao fixam uma nova) → **capture** o id da 1a run: varra o stream/log pelo registro do session id, ou leia o dir mais novo em `~/.copilot/logs` / `~/.copilot/history-session-state`. Grave em `<AUDIT>/<slug>.session`. **Confirme o campo exato do id no smoke test.** |
|
|
21
|
+
| `DONE_SIGNAL` | o registro JSON final do stream (fim de turno) |
|
|
22
|
+
| `USAGE` | o uso de tokens do registro final (confirme os nomes exatos dos campos no smoke test) |
|
|
23
|
+
|
|
24
|
+
**Modelo:** `--model` escolhe a engine (ex.: `claude-sonnet-4.5`, `gpt-5`). O Copilot nao tem flag numerica de
|
|
25
|
+
effort; mapeie "escalonamento" para o tier do modelo. Comece um tier abaixo do teto; escale conforme a `dw-cli-run`.
|
|
26
|
+
|
|
27
|
+
## Resume de sessao (o coracao)
|
|
28
|
+
O Copilot nao deixa fixar o id, entao na 1a run **capture** o session id (do stream/log ou `~/.copilot/logs`) e
|
|
29
|
+
grave em `<AUDIT>/<slug>.session` (duravel, fora da worktree → sobrevive ao `git worktree remove`). Pra voltar com
|
|
30
|
+
o **mesmo contexto**, leia o id e re-rode `RESUME <id>` (`copilot --resume="<id>" -p …` ou `--connect=<id>`) com o
|
|
31
|
+
prompt de follow-up — o Copilot recarrega a mesma sessao. Fallback se o sidecar sumiu: `copilot --continue -p …`
|
|
32
|
+
da mesma worktree.
|
|
33
|
+
|
|
34
|
+
> **Confirmacoes no smoke test (conforme o plano):** o campo exato do session-id no JSONL, os nomes dos campos de
|
|
35
|
+
> usage, e que `--resume=<id>` de fato continua o mesmo contexto — verifique numa worktree descartavel antes de
|
|
36
|
+
> confiar, e atualize esta tabela com o que achar.
|
|
37
|
+
|
|
38
|
+
## Variaveis de Input
|
|
39
|
+
| Variavel | Descricao | Exemplo |
|
|
40
|
+
|----------|-----------|---------|
|
|
41
|
+
| `<WORKTREE>` | git worktree dedicada (off main) | `~/code/vizzita-billing-s10` |
|
|
42
|
+
| `<PROMPT>` | caminho do prompt/spec preparado | `.dw/spec/prd-billing-integrador/codex-prompt.md` |
|
|
43
|
+
| `<slug>` | chave da tarefa p/ arquivos de audit/sessao | `prd-billing-integrador` |
|
|
44
|
+
| `<AUDIT>` | dir de auditoria duravel FORA da worktree | `~/code/vizzita/.dw/cli-run` |
|
|
45
|
+
|
|
46
|
+
Retorne pelo **Structured Return** da `dw-cli-run` (Status/Score/Scope/Evidence/Artifacts/Decisions/Risks/
|
|
47
|
+
Telemetria/Next Step), incluindo o `session-id` capturado, o caminho do sidecar, e o comando `RESUME` exato pra
|
|
48
|
+
continuar.
|
|
49
|
+
</system_instructions>
|
|
@@ -24,25 +24,25 @@
|
|
|
24
24
|
"bundled": true
|
|
25
25
|
},
|
|
26
26
|
{
|
|
27
|
-
"name": "dw-
|
|
27
|
+
"name": "dw-cli-run",
|
|
28
28
|
"kind": "protocol",
|
|
29
29
|
"tier": "core",
|
|
30
|
-
"owner": "dw-
|
|
31
|
-
"trigger": "
|
|
32
|
-
"expected_output": "
|
|
30
|
+
"owner": "dw-codex-run,dw-claude-run,dw-copilot-run",
|
|
31
|
+
"trigger": "Fire an AI CLI (Codex/Claude/Copilot) in a dedicated git worktree to implement a prepared prompt; resumable per-task session; STOP for the gate",
|
|
32
|
+
"expected_output": "Audit-logged run with a 0-10 dual evaluation, a resumable session-id sidecar, and a STOP-for-gate Structured Return.",
|
|
33
33
|
"load_policy": "lazy-references",
|
|
34
|
-
"context_limit":
|
|
34
|
+
"context_limit": 18000,
|
|
35
35
|
"bundled": true
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
|
-
"name": "dw-
|
|
38
|
+
"name": "dw-codebase-intel",
|
|
39
39
|
"kind": "protocol",
|
|
40
40
|
"tier": "core",
|
|
41
|
-
"owner": "dw-
|
|
42
|
-
"trigger": "
|
|
43
|
-
"expected_output": "
|
|
44
|
-
"load_policy": "
|
|
45
|
-
"context_limit":
|
|
41
|
+
"owner": "dw-intel",
|
|
42
|
+
"trigger": "Codebase indexing or codebase intelligence query",
|
|
43
|
+
"expected_output": ".dw/intel index files or a cited answer from the index.",
|
|
44
|
+
"load_policy": "lazy-references",
|
|
45
|
+
"context_limit": 12000,
|
|
46
46
|
"bundled": true
|
|
47
47
|
},
|
|
48
48
|
{
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dw-cli-run
|
|
3
|
+
description: "Shared runner protocol for the dw-*-run commands (dw-codex-run / dw-claude-run / dw-copilot-run). Fires an autonomous AI CLI (Codex / Claude / Copilot) INSIDE a dedicated git worktree to implement a prepared prompt/spec, with streaming captured to a durable audit log, a resumable per-task session, a 0–10 dual evaluation, graded escalation, and a STOP for the human gate. Loaded by those commands — substitute the CLI-specific adapter table they supply. NEVER runs in the main checkout; NEVER auto-merges (the owner decides after the gate)."
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- Bash
|
|
6
|
+
- Read
|
|
7
|
+
- AskUserQuestion
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# dw-cli-run — fire an AI CLI in the right worktree, audit it, keep the session, stop for the gate
|
|
11
|
+
|
|
12
|
+
CLI-**agnostic** core protocol for the delegation step of `dw-codex-run` / `dw-claude-run` / `dw-copilot-run`: a
|
|
13
|
+
**git worktree** holds a **prompt/spec** already prepared → this protocol fires the autonomous CLI there
|
|
14
|
+
(streaming, non-blocking) → **captures the whole run to a durable audit log** → **keeps a resumable per-task
|
|
15
|
+
session** → **evaluates the delivery 0–10** → escalates on failure → **STOPS for the gate** (merge is the owner's
|
|
16
|
+
call). It exists because running these CLIs by hand is repetitive and risky: wrong worktree, hangs without a TTY,
|
|
17
|
+
lost audit trail, and forgetting to measure quality before merge.
|
|
18
|
+
|
|
19
|
+
> **Dual-use:** these CLIs perform **autonomous edits with auto-approve**. Confirm the **right worktree** and the
|
|
20
|
+
> **scope** before firing. The isolated worktree is the mitigation that justifies the auto-approve flag.
|
|
21
|
+
|
|
22
|
+
## The adapter table (supplied by the invoking command)
|
|
23
|
+
The command that loaded you (`dw-codex-run` / `dw-claude-run` / `dw-copilot-run`) provides a **CLI adapter table**
|
|
24
|
+
with these slots. Substitute them into the steps below — everything else is identical across CLIs:
|
|
25
|
+
|
|
26
|
+
| Slot | Meaning |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `DISPATCH` | first-run command (background, streaming → audit log, `</dev/null`) |
|
|
29
|
+
| `STREAM` | flag(s) that make it emit parseable streaming events (JSON/JSONL) |
|
|
30
|
+
| `AUTO` | auto-approve / non-interactive flag (justified by the isolated worktree) |
|
|
31
|
+
| `RESUME <id>` | re-run command that **continues the SAME session/context** by id |
|
|
32
|
+
| `RESUME_LAST` | "resume the last session of this cwd" fallback |
|
|
33
|
+
| `SESSION_ID` | how to obtain/fix the session-id (from the stream, a sidecar, or a flag) |
|
|
34
|
+
| `DONE_SIGNAL` | the stream event that means the turn finished |
|
|
35
|
+
| `USAGE` | where token usage appears in the stream |
|
|
36
|
+
|
|
37
|
+
If the command did not supply an adapter table, return `BLOCKED` — this skill is not invoked standalone.
|
|
38
|
+
|
|
39
|
+
## RULE (hard) — never the main thread / main checkout
|
|
40
|
+
Run **only** inside a **dedicated git worktree** (off main). **NEVER** fire the CLI in the repo's **main checkout**
|
|
41
|
+
(the root tree on the primary branch, e.g. `~/code/<project>` on `main`) — the CLI edits autonomously and that
|
|
42
|
+
would corrupt the owner's active tree. If the target is the main checkout, **ABORT** (`BLOCKED`) and instruct:
|
|
43
|
+
create/use a worktree first (`git worktree add ../<project>-<slug> -b <branch> main`). Mandatory check before
|
|
44
|
+
running: `git worktree list` → the target is a secondary worktree (not the one flagged as main) **AND** the CLI's
|
|
45
|
+
`cwd` is that worktree.
|
|
46
|
+
|
|
47
|
+
## Pre-flight (fail early > run in the wrong place)
|
|
48
|
+
1. `<cli> --version` answers (CLI + credentials present). Missing → `BLOCKED`.
|
|
49
|
+
2. `git worktree list` — confirm the target worktree and that it is **not** the main checkout.
|
|
50
|
+
3. A **prompt/spec** exists (what the CLI receives). Common conventions: `.dw/spec/<slug>/codex-prompt.md`
|
|
51
|
+
(dev-workflow), `PROMPT.md`, `TASK.md`, or a path the owner names. **Read it** — it is the scope/fence/gate.
|
|
52
|
+
|
|
53
|
+
## Where to run — pick the VEHICLE (the main thread NEVER runs inline)
|
|
54
|
+
The main thread **orchestrates**; execution goes to one of these:
|
|
55
|
+
- **Workflow (PREFERRED)** — when there is a pipeline (CLI implements → evaluate 0–10 → **gate fan-out**). One
|
|
56
|
+
workflow agent runs the CLI (network OK). Shows in `/workflows` + parallelizes. Structure as separate
|
|
57
|
+
**phases/agents**: `[agent that runs the CLI]` → `[gate agents]`.
|
|
58
|
+
- **Single Agent (subagent)** — one-off dispatch of ONE run, no gate fan-out. Lighter; background; returns the
|
|
59
|
+
report. Does not show in `/workflows`.
|
|
60
|
+
- **Background Bash** — fallback only (no workflow/agent harness). Needs network → run un-sandboxed so the CLI can
|
|
61
|
+
reach its API.
|
|
62
|
+
|
|
63
|
+
> **Nesting:** the agent running the CLI **must not spawn further subagents** (nesting limit; Workflow nests only
|
|
64
|
+
> 1 level). The gate is **another phase/agent** of the workflow — never a sub-spawn from inside the runner agent.
|
|
65
|
+
|
|
66
|
+
## Protocol
|
|
67
|
+
1. **Resolve target.** Worktree + prompt path (from the user or inferred). Derive a `<slug>` (the spec slug or
|
|
68
|
+
worktree tag) — it keys the durable audit log and the session sidecar.
|
|
69
|
+
2. **Model + effort — the parent SIZES the complexity and proposes.** Read the prompt and size it; **propose**
|
|
70
|
+
model+effort with a one-line rationale (CLI-specific names live in the adapter table); the owner confirms or
|
|
71
|
+
overrides; if told "you pick", decide by heuristic. Signals: number of tasks; fence breadth; sensitive surface
|
|
72
|
+
(auth/security/tenant/migration/financial); "foundation/redesign/architectural" vs "mechanical fix/typo/docs";
|
|
73
|
+
E2E/secure-audit in the gate. Start **one notch below the ceiling** and escalate on failure (see Escalation).
|
|
74
|
+
3. **Set up the durable audit dir (OUTSIDE the worktree).** `<AUDIT>=<main-repo-or-home>/.dw/cli-run/` — it MUST
|
|
75
|
+
survive `git worktree remove` (the worktree's `QA/` is wiped on merge). Files: `<AUDIT>/<slug>.log` (stream),
|
|
76
|
+
`<AUDIT>/<slug>.session` (session-id sidecar), optionally `<AUDIT>/<slug>.last.md` (final message).
|
|
77
|
+
4. **Dispatch (first run) in BACKGROUND with streaming → durable audit log.** Use the adapter's `DISPATCH`:
|
|
78
|
+
```bash
|
|
79
|
+
cd <WORKTREE> && <DISPATCH ... STREAM AUTO ... "$(cat <PROMPT_PATH>)"> </dev/null \
|
|
80
|
+
> <AUDIT>/<slug>.log 2>&1 # durable streaming audit trail
|
|
81
|
+
```
|
|
82
|
+
- `</dev/null` ALWAYS (no TTY → hang). `STREAM` = parseable events; **don't** swallow everything with
|
|
83
|
+
`2>/dev/null`.
|
|
84
|
+
- **The stream log IS the audit trail (always capture).** It records, live and progressively, EVERYTHING the
|
|
85
|
+
CLI does: each shell `command`, item started/completed, the CLI's `agent_message` (reasoning + answers),
|
|
86
|
+
tool-calls, and the final `DONE_SIGNAL` (with `USAGE`/tokens). A "last message" capture (`-o` and friends)
|
|
87
|
+
holds only the **final** message; the stream holds the **whole path**.
|
|
88
|
+
- **Durability (critical for "audit later"):** write the stream log to a dir **outside** the worktree (step 3).
|
|
89
|
+
If it lived in the worktree's `QA/`, post-merge cleanup would delete it and the audit would vanish. Audit
|
|
90
|
+
later: shell commands `grep -oE '"command":"[^"]*"' <log>`; CLI reasoning/answers `grep '"agent_message"'
|
|
91
|
+
<log>`; tokens via the adapter's `USAGE` field; a readable transcript = `agent_message` + `command` in file
|
|
92
|
+
order.
|
|
93
|
+
5. **SESSION PER TASK (the heart) — capture on first run, resume by id.**
|
|
94
|
+
- **First run:** obtain the **session-id** per the adapter's `SESSION_ID` (from the stream, a sidecar, or a
|
|
95
|
+
fixed flag) and write it to the durable sidecar `<AUDIT>/<slug>.session` (one line: the id). This sidecar
|
|
96
|
+
lives outside the worktree → it survives `git worktree remove`.
|
|
97
|
+
- **Resume the SAME context:** read `<AUDIT>/<slug>.session` and re-run the adapter's `RESUME <id>` with the
|
|
98
|
+
follow-up prompt → the CLI continues the **same session/context** (its reasoning, the files it already
|
|
99
|
+
touched, the gate state). This is how "come back to the C6 run with full context" works: re-run with the id.
|
|
100
|
+
- **Fallback:** if the sidecar is missing, the adapter's `RESUME_LAST` resumes the last session of this cwd
|
|
101
|
+
(worktree = the session's cwd), so context is recoverable as long as you run from the same worktree.
|
|
102
|
+
- Always record the session-id + sidecar path in the Structured Return (Artifacts) so a later turn can resume.
|
|
103
|
+
6. **Detect "DONE" — by the stream, NEVER by `pgrep` of the worktree path.** The done signal is the adapter's
|
|
104
|
+
`DONE_SIGNAL` in the stream log **+** the worktree showing a commit/report (`git -C <worktree> log`, last
|
|
105
|
+
message filled). A `pgrep -f "<worktree-path>"` (or `-f "<...>/last-message"`) **self-matches your own grep
|
|
106
|
+
command** (the path is in the grep's argv) → false "running" that can hold a **READY** delivery for hours (and
|
|
107
|
+
a `until ! pgrep ...` waiter with that pattern **never terminates**, since it sees itself alive). In background
|
|
108
|
+
(`run_in_background`/Workflow), the **completion notification** is the signal. If you truly need pgrep,
|
|
109
|
+
restrict to `pgrep -af "<cli> "` and filter `/proc/<pid>/cmdline` — never pgrep the raw path.
|
|
110
|
+
7. **Gate needs network?** Auto-approve modes that keep a sandbox **block network** for the CLI's shell commands →
|
|
111
|
+
`install`/build/test/E2E fail with `EAI_AGAIN`. If the prompt tells the CLI to run the gate, the adapter's
|
|
112
|
+
`AUTO` flag must be the **network-allowed** variant (full access) so the CLI runs the gate and self-validates.
|
|
113
|
+
Justified because the **hard RULE** guarantees an isolated worktree. Without network in the gate, the CLI only
|
|
114
|
+
implements and reports `blockers` (the gate then sits with the parent).
|
|
115
|
+
8. **Read-only / analysis mode:** when only reviewing (no edits), use the adapter's read-only variant and drop the
|
|
116
|
+
auto-edit flag.
|
|
117
|
+
|
|
118
|
+
## Mandatory evaluation — 0–10 score (ALWAYS)
|
|
119
|
+
When the run finishes, the parent **evaluates the delivery and gives a 0–10 score** (10 = full conformance +
|
|
120
|
+
complete delivery). Do not skip it — it is the signal that decides gate vs escalation. Score against the prompt:
|
|
121
|
+
- **Scope/fence conformance** (did the ask; stayed inside the allowlist).
|
|
122
|
+
- **Technical gate** (lint/test/build/E2E per the prompt — green?).
|
|
123
|
+
- **Completeness** (every task/item delivered).
|
|
124
|
+
- **Hygiene** (committed, no junk, nothing outside the fence, no forbidden deps).
|
|
125
|
+
- **Quality / no regression.**
|
|
126
|
+
**Acceptance bar: score ≥9** (owner's decision). Bands: **≥9** = acceptable (ready for the human gate); **6–8** =
|
|
127
|
+
`FINDINGS` → **escalate** to reach ≥9; **<6** = failure → **escalate**. `BLOCKED` if the ladder is exhausted
|
|
128
|
+
without reaching 9. Always show the score + a short per-criterion rationale.
|
|
129
|
+
|
|
130
|
+
## Dual evaluation: the CLI auto-gates (MAX effort) → Claude re-gates (compares scores)
|
|
131
|
+
The CLI **can't grade its own exam alone** — hence two layers. The CLI auto-gates cheaply (close to the work) and
|
|
132
|
+
**Claude audits independently** and **compares the scores** (catches an inflated self-score).
|
|
133
|
+
1. **CLI auto-gate (loop, MAX effort).** The prompt MUST instruct: after implementing, **run the SAME gate** and
|
|
134
|
+
give a **self-score 0–10**; **fix and re-run while the self-score <9 or the gate isn't green**, at max effort.
|
|
135
|
+
Stop at self-score ≥9 + green gate (or report `blockers`). The final report carries the self-score + per
|
|
136
|
+
criterion.
|
|
137
|
+
2. **Claude re-gate (independent).** When the CLI declares pass, the parent **re-runs the SAME gate** (fan-out,
|
|
138
|
+
prefer Workflow → `/workflows`) and gives its **own 0–10** — without trusting the self-score.
|
|
139
|
+
3. **Compare + decide.** Claude ≥9 and small gap → **PASS** (ready for the owner's merge decision). Claude <9 OR a
|
|
140
|
+
large gap (CLI overestimated) → re-execute: hand the gaps back via **session resume** (step 5, max effort) and
|
|
141
|
+
repeat 1→2→3 until it converges. **The score that counts for acceptance is Claude's**; the self-score is signal
|
|
142
|
+
+ an inflation detector. Always record both scores + the gap in the Structured Return.
|
|
143
|
+
|
|
144
|
+
## Graded escalation on failure
|
|
145
|
+
If the score is low / the gate failed / the CLI didn't finish, **re-run the SAME task one notch up** — gradual, no
|
|
146
|
+
giving up on the first stumble, no jumping to the top.
|
|
147
|
+
- **Ladder (one at a time):** first **effort** low→medium→high→xhigh (adapter names them); exhausted, bump the
|
|
148
|
+
**model** one tier and reset effort to high. Re-run and **re-score**.
|
|
149
|
+
- **Continue vs restart:** coherent partial edits → **resume the session** (step 5, keeps context). Broken/dirty
|
|
150
|
+
worktree → **reset first** (`git -C <worktree> reset --hard && git clean -fd`) and run fresh at the higher notch
|
|
151
|
+
— don't stack error on error.
|
|
152
|
+
- **Stop:** at **score ≥9** (ready for the gate) OR when **exhausted** (strongest model + max effort still below)
|
|
153
|
+
→ `BLOCKED` with evidence. Announce each notch; with autonomy, escalate to the ceiling yourself.
|
|
154
|
+
|
|
155
|
+
## Detailed output → direct the next step
|
|
156
|
+
The delivery must be **detailed enough for the parent to decide the next step** — not an opaque "done". When it
|
|
157
|
+
finishes: **read the final message in full** + scan the stream; complement with `git -C <worktree> status` and
|
|
158
|
+
`git diff --stat` to see what truly changed (don't trust only what the CLI said). Then **produce a HANDOFF**: what
|
|
159
|
+
the **gate** should focus on, what to **adjust/redo**, whether to **escalate**, what's **outside the fence /
|
|
160
|
+
uncommitted**, and the **blockers** — record it in the Structured Return (Evidence/Artifacts/Next Step). If the
|
|
161
|
+
report is shallow, treat as `FINDINGS` and ask for detail (resume) or reconstruct it from the diff first.
|
|
162
|
+
|
|
163
|
+
## Telemetry (tokens + time) — always report
|
|
164
|
+
The stream ends with the adapter's `USAGE` block (token counts). Extract it from the log.
|
|
165
|
+
- **Effective billable ≈ `(input − cached_input) + output`** — input is often ~95%+ cache; reporting only the raw
|
|
166
|
+
number misleads. Show both (raw + effective).
|
|
167
|
+
- **Wall-clock:** the done event usually carries no duration → measure it yourself: wrap the dispatch with
|
|
168
|
+
`/usr/bin/time` or `date +%s` before/after. Report in minutes.
|
|
169
|
+
- **Command count:** `grep -c '"command"' <log>` (effort proxy).
|
|
170
|
+
- Record all of it under Structured Return → Telemetry. Useful for cost, escalation, and comparing fan-out phases.
|
|
171
|
+
|
|
172
|
+
## Discipline (when finishing)
|
|
173
|
+
- **STOP — not merged.** The CLI implemented in the worktree; **run the gate** (tests/lint/build + review; if the
|
|
174
|
+
project uses dev-workflow: `/dw-review` + `/dw-qa` + `/dw-secure-audit`) **before** any merge.
|
|
175
|
+
- **Merge = the owner's explicit decision.** Never automatic here.
|
|
176
|
+
- Flag **uncommitted** work or edits **outside the fence**.
|
|
177
|
+
- **Stop/abort a running CLI:** use **`TaskStop <task_id>`** (if `run_in_background`/Workflow) OR
|
|
178
|
+
**`git worktree remove --force <worktree>`** (pulls the rug — the CLI has nowhere to write and dies). Fallback:
|
|
179
|
+
`kill -9` **only** the PIDs from `pgrep -af "<cli> "` whose `/proc/<pid>/cmdline` matches the worktree tag.
|
|
180
|
+
**NEVER walk UP the process tree (ppid → ppid…) to kill "the supervisor":** the background CLI is a **child of
|
|
181
|
+
the Claude session itself** (`<cli> ← claude ← bash ← init`) → killing the ancestors **takes down the session**.
|
|
182
|
+
Apparent "respawns" are just the node workers of ONE run.
|
|
183
|
+
|
|
184
|
+
## Anti-patterns
|
|
185
|
+
- Running in the main checkout / without confirming the worktree — corrupts the active tree. *(pre-flight 2)*
|
|
186
|
+
- Merging/pushing inside the skill — merge lives outside, after the gate.
|
|
187
|
+
- Skipping the 0–10 score — loses the quality/escalation signal.
|
|
188
|
+
- Suppressing all output (or not capturing the stream to a log) — loses the audit of what the CLI did.
|
|
189
|
+
- **Detecting "done" by `pgrep` of the worktree path** — self-matches your own command → false "running" that
|
|
190
|
+
holds ready deliveries. Use `DONE_SIGNAL` + worktree. *(step 6)*
|
|
191
|
+
- **Killing the CLI by walking up the PID tree** — takes down the Claude session. Use `TaskStop`/`worktree
|
|
192
|
+
remove`. *(Discipline)*
|
|
193
|
+
- Losing the session-id — without the sidecar you can't resume the SAME context; capture it on the first run.
|
|
194
|
+
|
|
195
|
+
## Structured Return
|
|
196
|
+
- **Status:** `PASS` · `FINDINGS` · `BLOCKED` · `NOT_APPLICABLE` — `PASS` = ran, score ≥9, stopped clean in the
|
|
197
|
+
right worktree, ready for the gate; `FINDINGS` = ran, score 6–8 or caveats (uncommitted/out-of-fence/partial);
|
|
198
|
+
`BLOCKED` = missing CLI/credential/worktree/prompt/adapter table, or escalation exhausted without reaching 9;
|
|
199
|
+
`NOT_APPLICABLE` = no worktree+prompt → still planning.
|
|
200
|
+
- **Score:** **Claude's score** (0–10 — counts for acceptance, bar ≥9) + the **CLI self-score** + the **gap**;
|
|
201
|
+
per-criterion rationale (conformance/gate/completeness/hygiene/quality). Large gap = inflated self-score.
|
|
202
|
+
- **Scope:** worktree + branch + prompt used; CLI + model + effort + sandbox/auto mode; escalation notches taken.
|
|
203
|
+
- **Evidence:** path of the durable audit log + final-message file; stream JSONL excerpt; `git status`/diff of the
|
|
204
|
+
worktree post-run.
|
|
205
|
+
- **Artifacts:** files created/changed (diff summary); **the session-id + sidecar path** (`<AUDIT>/<slug>.session`)
|
|
206
|
+
so a later turn can resume; the durable audit log path.
|
|
207
|
+
- **Decisions:** model/effort and why; implementation vs read-only; continue (resume) vs reset on retry.
|
|
208
|
+
- **Risks:** out of fence, uncommitted, gate not run, dual-use (autonomous edits).
|
|
209
|
+
- **Telemetry:** tokens from the done event (input/cached/output/reasoning + **effective billable**) + **wall-clock**
|
|
210
|
+
+ command count.
|
|
211
|
+
- **Next Step:** "run the gate in the worktree; merge is the owner's decision" — and the exact resume command
|
|
212
|
+
(`RESUME <id>`) to continue this session.
|
|
213
|
+
|
|
214
|
+
## Notes
|
|
215
|
+
The CLI-specific flag names, model list, resume form, and session-id capture live in the **adapter table** of the
|
|
216
|
+
invoking command (`dw-codex-run` / `dw-claude-run` / `dw-copilot-run`). This skill holds the CLI-agnostic protocol
|
|
217
|
+
only; substitute the adapter slots and everything above applies unchanged.
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: dw-context-budget
|
|
3
|
-
description: Audit context overhead from commands, skills, agents, MCPs, and instruction files before sessions degrade.
|
|
4
|
-
allowed-tools:
|
|
5
|
-
- Read
|
|
6
|
-
- Grep
|
|
7
|
-
- Glob
|
|
8
|
-
- Bash
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# dw-context-budget
|
|
12
|
-
|
|
13
|
-
Use when a project has many commands, skills, agents, MCP servers, or long instruction files.
|
|
14
|
-
|
|
15
|
-
## Audit Targets
|
|
16
|
-
|
|
17
|
-
- `CLAUDE.md` and `AGENTS.md`
|
|
18
|
-
- `.dw/commands/*.md`
|
|
19
|
-
- `.agents/skills/*/SKILL.md`
|
|
20
|
-
- `.agents/agents/*.md`
|
|
21
|
-
- `.claude/agents/*.md`
|
|
22
|
-
- `.opencode/agent/*.md`
|
|
23
|
-
- `.claude/settings.json`
|
|
24
|
-
|
|
25
|
-
## Heuristics
|
|
26
|
-
|
|
27
|
-
- Prose estimate: `word count * 1.3`
|
|
28
|
-
- JSON/code estimate: `character count / 4`
|
|
29
|
-
- Flag command files over 20KB
|
|
30
|
-
- Flag `SKILL.md` files over 12KB
|
|
31
|
-
- Flag agent files over 8KB
|
|
32
|
-
- Flag more than 10 configured MCP servers
|
|
33
|
-
- Flag duplicate copies loaded by more than one platform when a fallback would be enough
|
|
34
|
-
|
|
35
|
-
## Report
|
|
36
|
-
|
|
37
|
-
Return:
|
|
38
|
-
|
|
39
|
-
1. Estimated overhead by category.
|
|
40
|
-
2. Top 10 largest files.
|
|
41
|
-
3. Duplicate or overlapping components.
|
|
42
|
-
4. Top 5 concrete savings.
|
|
43
|
-
5. What must remain loaded because commands depend on it.
|
|
44
|
-
|
|
45
|
-
Inspired by ECC's `context-budget` and `strategic-compact` patterns; adapted for dev-workflow's `.dw/` scaffold and cross-platform wrappers.
|
|
46
|
-
|
|
47
|
-
## Structured Return
|
|
48
|
-
|
|
49
|
-
When invoked directly or by a harness, return or merge this block:
|
|
50
|
-
|
|
51
|
-
- **Status:** `PASS` when the budget is acceptable, `FINDINGS` when concrete savings exist, `BLOCKED` when files cannot be measured, `NOT_APPLICABLE` when context budget is not relevant.
|
|
52
|
-
- **Scope:** commands, skills, agents, MCPs, and instruction files measured.
|
|
53
|
-
- **Evidence:** largest files, duplicate content, loaded references, and approximate byte/token cost.
|
|
54
|
-
- **Artifacts:** report path or inline budget table.
|
|
55
|
-
- **Decisions:** what stays loaded, what moves behind lazy references, and what can merge/remove.
|
|
56
|
-
- **Risks:** losing trigger clarity, hiding required instructions, or creating stale references.
|
|
57
|
-
- **Next Step:** top compaction action with expected savings.
|