Skip to content

Repository files navigation

πŸ”· PRISM

Stop letting your AI agent one-shot 2000-line changes it doesn't understand.

Recursive decomposition workflow for AI coding agents β€” turn a vague idea into an implemented, verified change through small, confirmable steps.

CI Go License: MIT PRs Welcome Works with: Claude Code Works with: Cursor Works with: 9 agents

prism init demo

The problem

You ask an AI agent for a non-trivial feature. It either:

  • dives straight into code and you discover its (wrong) design decisions in a 1500-line diff, or
  • writes a 10-page design doc that you skim, approve without really reading, and that drifts from reality by step three.

Both fail the same way: the unit of review is too big. Humans are great at judging one small, concrete decision β€” and terrible at auditing a wall of text or a mega-diff.

The PRISM way

PRISM splits design into small recursive nodes β€” one digestible node.md at a time, each with an explicit decision gate. The agent proposes, you react, it drills deeper. Nothing gets implemented until every node is atomic β€” small enough to be obviously right.

flowchart LR
    P[propose] --> D[decompose]
    D --> R[drill]
    R -->|until atomic| R
    R --> I[integrate]
    I --> A[apply]
    A --> V[verify]
    V --> X[archive]
Loading

The core principles, baked into every command:

  • Decision-first, not analysis-first. Not "here are 3 options, you weigh them" β€” but "I propose X because Y; rejected B/C in one line." One thing to react to.
  • One small node at a time. You never face the whole analysis at once.
  • Recursive decomposition until a node becomes obvious.
  • Grounded in real code β€” the agent reads your codebase before designing, never in a vacuum.
  • No big upfront docs. They overwhelm and get skimmed. Forbidden by convention.
  • Sized to the change. A small-tier change is one atomic node: two gates total, no decomposition theater, integrate skipped entirely. The full flow is for changes that earn it.

Every node carries an explicit status (βšͺ proposed β†’ 🟑 in progress β†’ 🟒 atomic β†’ πŸ”΅ applied β†’ βœ… verified, plus ⏸ for user-deferred parts) with formally defined transitions β€” a killed session resumes exactly where it stopped, and status offers a gated repair when the state table and reality disagree.

Quick start

# Go toolchain:
go install github.com/mcoder33/prism@latest

# or, no Go required β€” prebuilt binary (Linux/macOS):
curl -fsSL https://raw.githubusercontent.com/mcoder33/prism/main/install.sh | sh
# (Windows: grab the .zip from the Releases page.)

cd your-project
prism init          # interactive TUI β€” pick your agents

Then, inside your agent:

/prism:propose      # describe the problem, get a 1-screen seed proposal (+ change tier)
/prism:decompose    # split into 2-4 small parts (a single part for small-tier changes)
/prism:drill        # drill ONE part until atomic (spec, detail, diagram, tasks)
/prism:integrate    # cross-part wiring: diagram + combined signatures (skipped for small)
/prism:apply        # implement part-by-part, one commit per part, checks after each
/prism:verify       # pedantic QA on a running dev env: tests, smoke, concurrency, load
/prism:status       # where am I β€” phase, node table vs reality, the one next action

All design artifacts live in .prism/ at the repo root β€” git-excluded automatically, it's local working state. (Optionally a project can commit .prism/archive/ as shared reference β€” see the conventions installed by prism init.)

First time with PRISM?

  1. Skim the principles above.
  2. Open the worked example β€” a complete small-tier change, every artifact in its final state: .prism/archive/example-json-list/. Start with its README.md (the status table), then proposal.md and the 01-json-flag/ node.
  3. Run /prism:propose in your agent and let the gates walk you through your first change.

Inside a drilled node

/prism:drill takes one part and brings it to atomic. It writes the node.md digest first and stops at a gate β€” you react to the digest and the proposed artifact set before anything else is generated (trivial nodes skip the diagram and spec). Here's what that looks like for a 01-token-bucket node of a rate-limiter change β€” three artifacts carry the weight:

node.md β€” the unit of review. 5-7 lines. You react to this, not to a design doc:

node.md: What / Logic / Guarantees / Input-output digest, status, open questions

concept.drawio β€” a real diagram, not ASCII art. The agent hand-crafts mxGraph XML and validates it with xmllint. Open it in draw.io or the VS Code extension:

concept.drawio: request flows through middleware to Limiter.Allow, lazy refill, allow/deny branches

signatures.md β€” the API before any code. Signatures + what/why comments, no implementation. Catch a bad interface here, where changing it costs nothing:

signatures.md: Limiter interface, Decision struct, bucket internals with rationale comments

Plus spec.md (Requirement/Scenario β€” they drive the tests later) and tasks.md (the checklist apply executes). If a node turns out too big β€” drill redirects to decompose instead of patching on the fly.

What you get per change

.prism/<change>/
β”œβ”€β”€ proposal.md          Why / What / Constraints / Decisions / Non-goals  (< 1 screen)
β”œβ”€β”€ concept.md           candidate + chosen/rejected strategies
β”œβ”€β”€ data-flow.drawio     conceptual data-mutation chain
β”œβ”€β”€ 01-parser/           ← a node
β”‚   β”œβ”€β”€ node.md          5-7 line digest β€” the unit of review
β”‚   β”œβ”€β”€ spec.md          requirements as Requirement/Scenario
β”‚   β”œβ”€β”€ detail.md        decision-complete implementation plan
β”‚   β”œβ”€β”€ signatures.md    code sketch: signatures + what/why
β”‚   └── tasks.md         checklist the agent executes
β”œβ”€β”€ 02-renderer/         ← another node (drills into 02a, 02b... if needed)
β”œβ”€β”€ integration.drawio   how the parts connect
└── tasks.md             root order + cross-cutting concerns only

Switch between concurrent changes like git branches: /prism:use persists the active change in .prism/CURRENT, and every command targets it automatically.

Supported tools

One prism init installs native slash commands for every agent you use β€” same methodology, shared .prism/ state, so you can propose in Claude Code and apply in Cursor.

Tool Commands Invocation
Claude Code .claude/commands/prism/ /prism:propose
Cursor .cursor/commands/ /prism-propose
Codex CLI .codex/prompts/ /prism-propose
Gemini CLI .gemini/commands/prism/ /prism:propose
GitHub Copilot .github/prompts/ /prism-propose
Windsurf .windsurf/workflows/ /prism-propose
OpenCode .opencode/command/ /prism-propose
Roo Code .roo/commands/ /prism-propose
Cline .clinerules/workflows/ /prism-propose.md

Adding a tool is one adapters.Tool value (internal/adapters/adapters.go) β€” file path + naming + frontmatter format. PRs welcome.

Team setup

Two kinds of files, two different fates β€” this trips people up:

  • Generated command files (.claude/commands/prism/, .cursor/commands/, …) are normal repo files. Commit them so every teammate gets the slash commands on clone, without installing anything.
  • .prism/ (the conventions.md the commands read, plus your in-flight change artifacts) is git-excluded β€” local working state. On a fresh clone it isn't there.

So a teammate who clones a repo with committed commands still needs the shared conventions locally. The one-time bootstrap: install the CLI and run prism update (or prism init) once β€” it regenerates .prism/conventions.md in place. Run prism doctor to confirm everything lines up (versions match, .prism/ is git-excluded, no stale CURRENT). If you'd rather not have teammates install the CLI at all, commit .prism/conventions.md too (see the archive-sharing note in the installed conventions for how to un-exclude selectively).

How is this different from OpenSpec / spec-kit?

OpenSpec and spec-kit pioneered spec-driven AI development, and PRISM borrows the installer model from them. The difference is the shape of the artifact:

Spec-driven (OpenSpec, spec-kit) PRISM
Unit of review a spec document a 5-7 line node
Structure flat: spec β†’ tasks recursive tree, drill until atomic
Decision style options to evaluate one decision to react to
Depth control fixed per-node β€” drill only where it's murky
Post-implementation done at merge verify: tests, smoke, concurrency, load

If your changes are small, spec-driven is enough. PRISM earns its keep on changes where the design itself is the risk: refactors, new subsystems, concurrency, integrations.

CLI reference

prism init [path] [--tools claude,cursor|all]   # install commands (TUI without --tools)
prism update [path] [--force]                   # regenerate after a CLI upgrade
prism list [path]                               # list active changes in .prism/
prism doctor [path]                             # diagnose: version drift, stale pointer, prereqs
prism uninstall [path] [--tools …] [--shared]   # remove generated commands (keeps .prism/ work)

Generated files are tool-owned: each carries a prism:generated v<version> stamp and is overwritten wholesale by prism update β€” edit templates/, not the output. How to write template text (budgets, style, rejected framings): docs/template-style.md.

Single static binary, zero runtime dependencies, templates embedded via go:embed.

Development

make ci          # everything CI runs: test -race, vet, lint, vuln, mod-check
make test        # just the tests
make cover       # tests + coverage summary
make install     # build + put `prism` on PATH
make help        # list all targets

prism init --tools claude /tmp/sandbox        # smoke test

CI (GitHub Actions) runs the same five checks on every push and PR β€” the test job across a Linux/macOS/Windows matrix; lint and vuln auto-install their tools, so a fresh clone only needs Go. Pushing a v* tag runs GoReleaser to publish cross-platform binaries to the release (see .goreleaser.yaml).

Layout:

main.go                      entrypoint β†’ internal/cli
templates/                   tool-neutral command bodies + shared conventions (go:embed)
internal/
  workflows/                 command registry (id, title, description) + Version
  adapters/                  per-tool: paths, slash-command naming, frontmatter
  installer/                 detection, rendering, writing, git-exclude
  cli/                       cobra commands + bubbletea TUI

Stack: Go stdlib + cobra + bubbletea/lipgloss.

License

MIT


If PRISM saves you from one bad mega-diff, consider a ⭐ β€” it helps others find it.

About

πŸ”· Recursive decomposition workflow for AI coding agents β€” small confirmable design steps instead of mega-diffs. Installs /prism slash commands for Claude Code, Cursor, Codex, Gemini & more

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages