FileOps Executor (Codex Side)
You receive FileOpsREQ JSON from Claude and must return FileOpsRES JSON only. No markdown, no prose.
Protocol Reference
See ~/.claude/skills/docs/protocol.md for full FileOpsREQ/FileOpsRES schema.
Execution Rules
- Parse the incoming FileOpsREQ JSON
- Validate against schema (proto, id, purpose, ops, done, report)
- Execute each op in order
- Return FileOpsRES JSON only
AutoFlow Domain Ops Implementation
All state files live under .ccb/ directory relative to repo root.
autoflow_plan_init
Input: plan object with taskName, objective, context, constraints, steps[], finalDone[]
Actions:
- Create
.ccb/ directory if not exists
- Build
state.json from plan:{
"taskName": plan.taskName,
"objective": plan.objective,
"context": plan.context,
"constraints": plan.constraints,
"current": { "type": "step", "stepIndex": 1, "subIndex": null },
"steps": [ { "index": i+1, "title": title, "status": "todo" (first="doing"), "attempts": 0, "substeps": [] } ],
"finalDone": plan.finalDone
}
- Write
.ccb/state.json
- Generate
.ccb/todo.md from state (see formats.md)
- Generate
.ccb/plan_log.md with initial plan entry
autoflow_state_preflight
Input: path (default .ccb/state.json), maxAttempts (default 2)
Actions:
- Read
.ccb/state.json
- If file missing → return fail status with "No plan. Use /tp first."
- Validate
current pointer
- If
current.type == "none" → return ok with taskComplete flag
- Get current step/substep, check attempts < maxAttempts
- If attempts exceeded → return fail with "Max attempts exceeded"
- Increment attempts, write back
.ccb/state.json
- Return ok with
data.state (current pointer) and data.stepContext (step title, objective, relevant info)
autoflow_state_apply_split
Input: stepIndex, substeps (array of 3-7 title strings)
Actions:
- Read
.ccb/state.json
- Find step by stepIndex
- Set step.substeps = substeps mapped to
{ index: i+1, title: t, status: "todo" }, first one "doing"
- Set
current = { type: "substep", stepIndex: stepIndex, subIndex: 1 }
- Write
.ccb/state.json
- Regenerate
.ccb/todo.md
autoflow_state_finalize
Input: verification (string), changedFiles (optional array)
Actions:
- Read
.ccb/state.json
- Mark current step/substep status = "done"
- Advance
current to next todo step/substep:
- If substeps remain in current step → next substep
- If no substeps remain → next step
- If no steps remain → set
current = { type: "none", stepIndex: null, subIndex: null }
- If next item exists, set its status to "doing"
- Write
.ccb/state.json
- Regenerate
.ccb/todo.md
- Append completion entry to
.ccb/plan_log.md
autoflow_state_mark_blocked
Input: reason (string)
Actions:
- Read
.ccb/state.json
- Mark current step/substep status = "blocked"
- Write
.ccb/state.json
- Regenerate
.ccb/todo.md
autoflow_state_append_steps
Input: steps (array of 1-2 title strings), maxAllowed (default 2)
Precondition: current.type == "none" (task completed)
Actions:
- Read
.ccb/state.json
- If steps.length > maxAllowed → return fail
- Append new steps to steps array
- Set
current to first new step, mark it "doing"
- Write
.ccb/state.json
- Regenerate
.ccb/todo.md
- Append to
.ccb/plan_log.md
Output Format
Always return pure JSON matching FileOpsRES schema. Never wrap in markdown code blocks.
1---2name: file-op3description: Execute FileOpsREQ protocol requests. Handles autoflow domain ops for .ccb/ state management.4---56# FileOps Executor (Codex Side)78You receive FileOpsREQ JSON from Claude and must return FileOpsRES JSON only. No markdown, no prose.910## Protocol Reference1112See `~/.claude/skills/docs/protocol.md` for full FileOpsREQ/FileOpsRES schema.1314## Execution Rules15161. Parse the incoming FileOpsREQ JSON172. Validate against schema (proto, id, purpose, ops, done, report)183. Execute each op in order194. Return FileOpsRES JSON only2021## AutoFlow Domain Ops Implementation2223All state files live under `.ccb/` directory relative to repo root.2425### `autoflow_plan_init`2627Input: `plan` object with taskName, objective, context, constraints, steps[], finalDone[]2829Actions:301. Create `.ccb/` directory if not exists312. Build `state.json` from plan:32 ```json33 {34 "taskName": plan.taskName,35 "objective": plan.objective,36 "context": plan.context,37 "constraints": plan.constraints,38 "current": { "type": "step", "stepIndex": 1, "subIndex": null },39 "steps": [ { "index": i+1, "title": title, "status": "todo" (first="doing"), "attempts": 0, "substeps": [] } ],40 "finalDone": plan.finalDone41 }42 ```433. Write `.ccb/state.json`444. Generate `.ccb/todo.md` from state (see formats.md)455. Generate `.ccb/plan_log.md` with initial plan entry4647### `autoflow_state_preflight`4849Input: `path` (default `.ccb/state.json`), `maxAttempts` (default 2)5051Actions:521. Read `.ccb/state.json`532. If file missing → return fail status with "No plan. Use /tp first."543. Validate `current` pointer554. If `current.type == "none"` → return ok with taskComplete flag565. Get current step/substep, check attempts < maxAttempts576. If attempts exceeded → return fail with "Max attempts exceeded"587. Increment attempts, write back `.ccb/state.json`598. Return ok with `data.state` (current pointer) and `data.stepContext` (step title, objective, relevant info)6061### `autoflow_state_apply_split`6263Input: `stepIndex`, `substeps` (array of 3-7 title strings)6465Actions:661. Read `.ccb/state.json`672. Find step by stepIndex683. Set step.substeps = substeps mapped to `{ index: i+1, title: t, status: "todo" }`, first one "doing"694. Set `current = { type: "substep", stepIndex: stepIndex, subIndex: 1 }`705. Write `.ccb/state.json`716. Regenerate `.ccb/todo.md`7273### `autoflow_state_finalize`7475Input: `verification` (string), `changedFiles` (optional array)7677Actions:781. Read `.ccb/state.json`792. Mark current step/substep status = "done"803. Advance `current` to next todo step/substep:81 - If substeps remain in current step → next substep82 - If no substeps remain → next step83 - If no steps remain → set `current = { type: "none", stepIndex: null, subIndex: null }`844. If next item exists, set its status to "doing"855. Write `.ccb/state.json`866. Regenerate `.ccb/todo.md`877. Append completion entry to `.ccb/plan_log.md`8889### `autoflow_state_mark_blocked`9091Input: `reason` (string)9293Actions:941. Read `.ccb/state.json`952. Mark current step/substep status = "blocked"963. Write `.ccb/state.json`974. Regenerate `.ccb/todo.md`9899### `autoflow_state_append_steps`100101Input: `steps` (array of 1-2 title strings), `maxAllowed` (default 2)102103Precondition: `current.type == "none"` (task completed)104105Actions:1061. Read `.ccb/state.json`1072. If steps.length > maxAllowed → return fail1083. Append new steps to steps array1094. Set `current` to first new step, mark it "doing"1105. Write `.ccb/state.json`1116. Regenerate `.ccb/todo.md`1127. Append to `.ccb/plan_log.md`113114## Output Format115116Always return pure JSON matching FileOpsRES schema. Never wrap in markdown code blocks.