weft
Deterministic workflow tracking for Claude Code — smart skills, template management, dashboard auto-refresh.

Weft turns ad-hoc agent sessions into auditable, event-sourced workflows. Define a template (plan → implement → verify, or an 11-step ticket-to-PR cycle), and weft enforces the order, blocks tools that violate the current step's guards, and refuses to let you Stop with steps still pending.
Why this exists
Multi-step engineering work needs structure that survives compaction, retries, and the agent forgetting what step it's on. Weft solves three problems:
- Skills fire reliably —
/wf-start, /wf-step, /wf-status read state from disk, not memory.
- Templates apply consistently — workflows live in JSON, version-controlled with your project.
- Hooks enforce the contract —
PreToolUse, PreCompact, and Stop block out-of-order actions or premature exits.
State is an append-only event log under .claude/weft/, so every workflow is fully reconstructible.
Why not just use TODOs or Claude's task list?
Built-in TODOs and ad-hoc checklists live in the agent's context window. They're advisory — the model can ignore them, lose them across compaction, or skip steps it judges unnecessary. They have no enforcement, no replay, no per-step guards. Weft is the opposite tradeoff: a small contract written to disk, enforced by hooks, with an event log you can audit after the fact. Use TODOs when "the model probably remembers" is good enough. Use weft when it isn't.
Requirements
- Python 3.10+ (stdlib only — no runtime dependencies)
- Claude Code with plugin support
- macOS or Linux (the dashboard uses
curses; Windows is untested)
Quick Start
Weft ships as a Claude Code plugin. Install via the marketplace:
/plugin marketplace add dioptx/weft
/plugin install weft@dioptx-weft
Or, for development / hacking on weft itself:
git clone https://github.com/dioptx/weft.git
claude --plugin-dir ./weft
The plugin auto-registers four hooks (SessionStart, PreToolUse, PreCompact, Stop) and 11 skills via .claude-plugin/plugin.json and hooks/hooks.json. Restart Claude Code and the /wf-* commands become available.
First workflow
/wf-start generic # plan → implement → verify
/wf-status # show current state
/wf-step complete # advance to the next step
/wf-analyze # per-template timing + recurring friction across runs
Run /wf-start with no args for the guided template picker.

See docs/demo.md for an annotated end-to-end walkthrough, and docs/demos/ for the asciicasts and recording scripts behind every GIF in this README.
Compose your own workflow
Templates are JSON. You can author one inline and pipe it to weft save-template — no editor required, no scaffolder. The template lands in .claude/weft/templates/ and is immediately available to weft start.

cat > flow.json << 'EOF'
{
"name": "site-audit",
"steps": [
{"name": "crawl", "skill": "/perplexity"},
{"name": "review", "skill": "/staff-review"},
{"name": "fix", "skill": "/fix-polish"},
{"name": "verify", "loop_back_to": "review", "max_iterations": 3,
"exit_condition": "no high-severity findings"},
{"name": "push",
"guards": [{"command_pattern": "\\bgit\\b(?!\\s+stash\\b)[^|;&\\n]*\\bpush\\b",
"message": "git push may run only during push, after verification"}]}
]
}
EOF
weft save-template < flow.json
weft start site-audit
For interactive composition based on what's in your current conversation, use /wf-compose.
How guards work
Each denial also appends a JSONL event to ~/.local/state/agentry/events.jsonl.
Set AGENTRY_EVENTS_PATH to override that path. The event contains event: "guard",
tool, input (the refused command or file path), and rule (the matched regex).
build_id and task come from the JSON object in AGENT_P_TAGS; missing or invalid
tags produce null values. A stream write failure warns but still denies the call.
A guard means this command may run only on its owner step. During a running
workflow, the engine skips the current step's guards and checks every other
step's guards. A match there blocks the call. Put each command's guard on one
step: putting the same guard on two steps blocks the command on every step,
because another owner's guard always matches.