agentleFS
kronaelkronael/ship/CLAUDE.md

ship

CLAUDE.md1 starsChanged 9 months agoMITView on GitHub

autonomous agent orchestration. planner-worker-judge pattern. state mutations: lock before read/write, save() under lock, copy before return. config precedence: CLI args > env vars > .env file > defaults.

  • Reads credentials
  • In this repositoryOne other file it gives its agents.

The file

We split this CLAUDE.md into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    when all complete: refiner (codex CLI) critiques batch if -x enabled, creates follow-up tasks

    line 47
  2. Distinctive:

    if refiner finds nothing: replanner (claude CLI) does full assessment vs goal

    line 48
  3. Distinctive:

    if replanner exhausted: adversarial verifier generates challenges as tasks (3 rounds max)

    line 49

≈ “Common” is an estimate: at least 1 in 5 of the 28,633 CLAUDE.md 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

autonomous agent orchestration. planner-worker-judge pattern.

build and run

make build              # uv sync
make install            # uv tool install + skill
make test               # pytest
make lint               # pre-commit run -a
make right              # pyright only
make clean              # rm cache + state
ship <file>             # ship from file
ship <dir>              # ship from dir
ship <arg> <arg> ...    # args as context
ship -f                 # wipe state, start fresh
ship -k                 # validate spec only (exit 0/1)
ship -n 8 -t 600 -m 10 # override workers/timeout/turns
ship -s                 # skip validation, trust spec as-is
ship -p "use stdlib"    # inject override into all LLM calls
ship -x                 # enable refiner (codex CLI critique)
ship -v                 # verbose (-v: details, -vv: debug)
ship -q                 # quiet (errors only)
ship -h                 # help

defaults

  • workers: 4
  • max_turns: 50
  • task_timeout: 2400s (40min, agents told the real value)
  • spec discovery: file or dir required on cmdline (no auto-discovery)
  • verbosity: 1 (0=quiet, 1=default, 2=verbose, 3=debug)

how it runs

  1. validator checks spec -> rejects to .ship/REJECTION.md or writes PROJECT.md; result cached in .ship/validated (SHA256)
  2. planner runs once -> breaks design into tasks (with mode + worker assignment)
  3. workers pull from queue, execute via claude CLI (parallel or sequential)
  4. judge polls every 5s, updates TUI panel, retries failed tasks
  5. when all complete: refiner (codex CLI) critiques batch if -x enabled, creates follow-up tasks
  6. if refiner finds nothing: replanner (claude CLI) does full assessment vs goal
  7. if replanner exhausted: adversarial verifier generates challenges as tasks (3 rounds max)
  8. loop continues until no new tasks generated

critical patterns

if task.status is TaskStatus.PENDING:  # use 'is' not ==

state mutations: lock before read/write, save() under lock, copy before return.

config precedence: CLI args > env vars > .env file > defaults.

shocking bits

  • -s skips validation entirely, trusts the spec as-is; saves validated hash so subsequent runs also skip
  • -k and -s are mutually exclusive
  • -k runs validation then exits: 0=accepted, 1=rejected; writes .ship/validated cache
  • continuation is implicit: no state → fresh run; same spec + incomplete → auto-resumes; same spec + complete → prints "done, use -f to restart" and exits 0
  • spec changed: LLM call decides keep-completed-tasks (add on top) or replan-from-scratch
  • -f always wipes state; -c is a hidden alias kept for backwards compat
  • -p TEXT injects override prompt into validator, planner, worker, replanner/refiner/verifier; persisted in work.json so it survives across sessions
  • -n is the canonical workers flag; -w is a hidden alias kept for backwards compat
  • validation cache (.ship/validated) skips the LLM call entirely if spec SHA256 matches
  • rejection gaps printed to stdout at verbosity >= 1; full rejection text at >= 2
  • planner runs once at startup, not continuously
  • queue not persisted, rebuilt from pending tasks on resume
  • claude CLI called with --permission-mode bypassPermissions always
  • refiner uses codex CLI (cheaper/faster), replanner uses claude CLI (deeper)
  • refiner only runs when -x flag is set (use_codex: bool in config)
  • workers told actual timeout from config
  • failed tasks auto-retry up to 10 times (timeout is just cleanup)
  • planner produces feature-level work packages (not micro-tasks); told "2 day tasks"
  • planner can set execution mode (parallel/sequential) and pin tasks to workers
  • sequential mode: -n flag overrides the auto-reduction to 1 worker
  • subprocess cleanup: SIGTERM, wait 10s, then SIGKILL
  • TUI shows full task overview (status icons ✓/✗/⟳/·) + per-worker activity lines + summary; events buffered between refreshes
  • workers receive spec content inline in prompt (read at dispatch time, not by agent)
  • workers read PLAN.md and CLAUDE.md before executing their task
  • execute() uses --output-format stream-json for real-time NDJSON progress events; 16MB stdout buffer
  • _parse_output returns a 3-tuple (status, followups, summary) — not a dataclass yet
  • git diff stats (_git_head + _git_diff_stat) appended to LOG.md after each task
  • adversarial verifier: 10 challenges/round, picks 2 random, queues as tasks; deduped across rounds
  • validator catches ClaudeError (including timeouts) and retries; same retry semantics as refiner/replanner/verifier
  • refiner/replanner/verifier timeouts are inconclusive (retry), not treated as success; attempt counters only increment on successful calls
  • final done/total count uses post-run task list — total grows as replanned tasks are added during execution

state

.ship/ (internal, gitignored): tasks.json, work.json, validated, log/ship.log, log/trace.jl project root (LLM-visible): SPEC.md, PLAN.md, PROGRESS.md, LOG.md, PROJECT.md

key files

  • __main__.py - entry point, click CLI, main orchestrator
  • types_.py - Task (with worker field), TaskStatus, WorkState (with execution_mode, spec_hash, override_prompt)
  • state.py - StateManager with asyncio.Lock
  • config.py - loads .env + env vars, verbosity int (0-3), use_codex bool
  • display.py - TUI with task overview panel, worker progress lines, buffered events
  • planner.py - design -> tasks + mode + worker assignments via claude CLI
  • validator.py - rejects bad designs, writes PROJECT.md; fallback tag extraction for empty gaps; retries on ClaudeError/timeout
  • worker.py - executes tasks via ClaudeCodeClient, embeds spec content in prompt, appends git diff to LOG.md
  • claude_code.py - claude CLI wrapper, NDJSON stream-json output, on_progress callbacks
  • codex_cli.py - codex CLI wrapper (used by refiner)
  • judge.py - polling orchestrator, triggers refiner/replanner/adversarial
  • refiner.py - quick batch critique via codex CLI
  • replanner.py - deep goal assessment via claude CLI
  • prompts.py - all 7 LLM prompts (markdown with ## headers, bullet lists)

commit messages

[section] message - lowercase, imperative

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.