planning-with-crux
Skill1 starsChanged 58 days agoMITView on GitHub
Design and author agentic workflows using the crux DSL — both YAML pipeline files (.crux) and Rust macro-based agents. Use when writing a .crux pipeline, designing an agent workflow, choosing between crux combinators (pipe, join_all, speculate, route_on_confidence, delegate), or planning how to decompose a task into crux steps. Triggers on "write a pipeline", "crux pipeline", ".crux file", "agentic workflow", "agent plan", "step handler", "which combinator", or any request involving pipeline design, step composition, or handler selection. Also use when reviewing or debugging existing pipelines.
In this repository76 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- godmode:agent-governanceSkill
- godmode:agent-improvement-loopSkill
- agents-skill-saveSkill
- baml-add-typesSkill
- godmode:brainstormSkill
- godmode:capSkill
- godmode:changelogSkill
- godmode:ci-fixSkill
- godmode:code-reviewSkill
- godmode:context-mapSkill
- godmode:cross-issueSkill
- godmode:crs-discoverSkill
- godmode:crs-hook-testingSkill
- godmode:crs-installSkill
- godmode:crs-propose-rulesSkill
- godmode:crs-validateSkill
- godmode:dead-codeSkill
- godmode:decomposeSkill
- godmode:dep-auditSkill
- godmode:dep-bumpSkill
- godmode:designSkill
- devloop-session-primerSkill
- godmode:dialecticSkill
- godmode:doc-maintainerSkill
- godmode:doc-reviewSkill
- godmode:doc-syncSkill
- godmode:doc-writerSkill
- doob-db-inspectorSkill
- doob-release-managerSkill
- godmode:doublecheckSkill
- dual-forge-pr-mergeSkill
- gh-bulk-issuesSkill
- godmode:health-scoreSkill
- godmode:ingestSkill
- godmode:introspectionSkill
- godmode:issue-triageSkill
- godmode:memory-bankingSkill
- godmode:mergeSkill
- godmode:mini-context-graphSkill
- godmode:mistake-trackerSkill
- godmode:moaSkill
- notfiles-release-workflowSkill
- godmode:observability-as-infrastructureSkill
- godmode:parallel-agentsSkill
- godmode:pattern-learnerSkill
- godmode:pr-authorSkill
- godmode:receiving-reviewSkill
- godmode:refactoringSkill
- godmode:release-notesSkill
- release-readiness-checkSkill
- remote-upstream-triageSkill
- repo-gap-backlogSkill
- godmode:rust-conventionsSkill
- rustqualSkill
- rustqual-workspaceSkill
- rust-release-workflow-authorSkill
- godmode:self-reflectSkill
- session-wrap-commit-pushSkill
- godmode:systematic-debuggingSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 0 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 23
Run with crux run pipeline.crux [input.json].
- Very specific: line 46
Every pipeline produces a Crux<Value> trace.
- Very specific: line 61
Read references/combinator-patterns.md for worked examples of each pattern and guidance on composing them together.
- Very specific: line 66
Read references/handler-catalog.md for the complete handler reference organized by category (shell, fs, git, json, text, llm, ci, review, …
- Very specific: line 72
Use capture when the command must succeed.
- Very specific: line 73
handler()vshandler_value(): If a handler needs to emit confidence for route_on_confidence, register with handler() and return …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Planning with Crux
Crux makes agentic control flow explicit. Every step, branch, delegation, and failure is a first-class value in the trace. This skill helps you design workflows that use these primitives effectively.
Two Modes of Authoring
- YAML pipelines (
.cruxfiles) — declarative, no Rust compilation needed. Run withcrux run pipeline.crux [input.json]. Good for orchestration tasks that compose built-in handlers. - Rust agents (
#[crux::agent]) — full type safety, custom logic, async. Compile into binaries. Good for complex domain logic that needs Rust's type system and error handling.
Choose YAML when the workflow is a composition of existing handlers (shell commands, file ops, git, JSON transforms, LLM calls). Choose Rust when you need custom types, complex branching, or the workflow will be a library.
Pipeline Anatomy
pipeline: my_workflow # Required: name (appears in trace)
budget: { calls: 10 } # Optional: tokens, calls, duration_ms, cost_cents
steps: # Required: list of step definitions
- step: first_step
handler: shell::capture
args:
cmd: "echo hello"Every pipeline produces a Crux<Value> trace. The last step's output is the
pipeline result.
Choosing a Combinator
| Pattern | Combinator | When to use |
| Do A, then B, then C | pipe: | Sequential stages, each feeds next |
| Do A, B, C simultaneously | join_all: | Independent work, merge results |
| Try multiple approaches | speculate: first_ok | Fallback chain, first success wins |
| Pick the best attempt | speculate: pick_best | Race approaches, score and select |
| Branch on confidence | route_on_confidence: | Different actions for different scores |
| Hand off to sub-agent | delegate: | Encapsulated child agent |
| Single action | step: | One handler invocation |
Read references/combinator-patterns.md for worked examples of each pattern
and guidance on composing them together.
Handler Selection
Read references/handler-catalog.md for the complete handler reference
organized by category (shell, fs, git, json, text, llm, ci, review, etc.).
Key principles:
shell::capturefails on non-zero exit;shell::execignores it. Usecapturewhen the command must succeed. Useexecfor best-effort.handler()vshandler_value(): If a handler needs to emit confidence forroute_on_confidence, register withhandler()and returnHandlerOutput::with_confidence(value, score). If it just returns data, usehandler_value().- Template expressions
{{ steps.X.output.field }}and{{ input.field }}expand inargs:values. Use these to pass data between steps.
Budget Design
Set budgets to prevent runaway execution:
budget: { calls: 10 } # Max 10 handler invocations
budget: { tokens: 15000 } # Max 15k tokens (LLM steps)
budget: { duration_ms: 300000 } # Max 5 minutes wall clock
budget: { cost_cents: 50 } # Max $0.50For Rust agents, budgets can be scoped per delegation:
x.delegate::<SubAgent>("task", input)
.with_budget(Budget::tokens(5000))
.run()
.await?Pipeline Design Process
- Name the outcome — what does the pipeline produce?
- List the steps — what information or actions are needed?
- Identify dependencies — which steps need outputs from other steps?
- Choose combinators — sequential (pipe), parallel (join_all), or branching?
- Set the budget — what's the maximum acceptable cost/time?
- Add confidence routing — should different confidence levels trigger different actions?
Rust Agent Patterns
See references/rust-agent-patterns.md for the #[crux::agent] macro
patterns, including steps, delegation, speculation, lifecycle hooks, replay,
and task registry integration.
Common Mistakes
- Forgetting
handler:on a step — the step name is used as handler name ifhandler:is omitted. This works if your handler is named the same as your step, but fails silently if not. - Non-covering confidence routes — ranges must cover
[0.0, 1.0]with no gaps. Use[0.0, 0.5),[0.5, 0.8),[0.8, 1.0]— note the inclusive end on the last range. - Using
handler_value()withroute_on_confidence—handler_value()handlers don't emit confidence. Usehandler()and returnHandlerOutput::with_confidence(). speculate: pick_bestwithoutscore— arms must include ascorefield in their output JSON. Arms withoutscoreall tie at 0.0.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

