The discern project Map
Explore the account of the codebase that discern's coding agents maintain for project work and human review. Each entry opens its Markdown file in the source repository.
Orientation
What discern is, why it works this way, and where to go next. Read this section first.
- Concepts
The mental model of discern in one pass: the Gate, isolated worktrees, compiled instructions, and file ownership.
- Design principles
The rules that govern discern, their repository effects, and accepted requirements awaiting implementation.
- Trust & your data
What discern does and does not do on your machine: no network, no telemetry, and your configured commands only.
- Secure entropy
How discern generates security-sensitive identifiers and bytes without weakening production randomness for tests.
- The practice
The tenets discern holds, each with the belief behind it, the obligation, and how it is upheld.
- System map
The architecture as one picture: how the binary, an install, and the run-time verbs relate.
- Glossary
Look up discern terms, understand their meaning, and find the next useful explanation.
Getting started
Install discern, set up a repository, run the first gated change, troubleshoot setup, and upgrade later.
- Quickstart
Install discern, hand setup to your coding agent, and land your first gated change.
- Setup decisions
Understand why setup recommends a strong model, which choices remain yours, and what the agent should handle without interrupting you.
- Setup walkthrough
Follow the setup conversation, verification run, first worktree, Gate Proof, and reviewed landing in detail.
- After setup
Read the setup diff file by file, including what you edit, what discern shares, and what it regenerates.
- Upgrade discern
Update the discern binary, migrate the project to match it, restart agent sessions, and verify the result.
The quality gate
Fix a red Gate, understand what discern done runs, and choose the next quality tool for your task.
- When the Gate fails
Read a red discern done result, reproduce the failed job, and take the shortest route to the fix.
- Standards
Hold a stable quality claim at a floor or ceiling that branches can tighten but not redefine.
- Complete evidence
Trace the committed tip through required production, evidence reuse, and Proof.
- Checkpoints
Change-triggered judgment stops — a deterministic trigger serves a question, the agent records a conclusion, and the Proof carries it as agent evidence.
- The Proof
Read the review summary a clean green Gate records for the exact commit that passed.
- Proof notes
Keep a landed green Proof with its trunk commit, and opt into fetch transport when another clone needs it.
- Strand detection
Find tracked files a Gate stage changed after the final commit, with the responsible stage named.
- Run the Gate in CI
Run discern done --ci on GitHub Actions and require the machine Gate result before a pull request can merge.
- Continuous improvement
Use discern improvement to find one objective fix or qualitative review that raises the project's baseline.
- Completion observations in Patterns
Interpret validation repeats, measured durations, and producer accounting without inferring authority or author quality.
- Coupling
Use Git history to find files that usually change with the work on your branch and may have been missed.
- Practice patterns
Read what the Logbook shows about local workflow patterns: command loops, Gate fit, funnel flow, and each Standard's trajectory.
- Format discern-owned surfaces
Run discern tidy directly or from the format job to keep the Map, instructions, TODO, and root config canonical.
- The fleet test-run cap
Cap how many test-stage runs execute at once across every checkout of the repository with [gate].concurrent_test_runs.
- Practice stats
Read the Logbook for accepted changes, validation routes, green streaks, cycle times, Standards trends, and agent cohorts in plain counts.
- Validation findings
How Patterns compares per-job validation outcomes under matched and controlled recorded conditions.
- Patterns decision evidence
Read the project-local evidence required before Patterns recommends a Gate configuration or Standard pin.
- Pattern investigations
Trace related Pattern findings into bounded, evidence-backed diagnostic paths.
- Checkpoint recipes
Copyable checkpoint triggers for common review moments, with advice on stop and advise modes.
Worktrees
How discern isolates each change, keeps concurrent work separate, and lands reviewed branches on the trunk.
- Start, update, and accept
What discern creates at start, refreshes at update, and removes after a submitted change lands.
- The trunk
The shared branch accepted work lands on, what moves it, and why work stays off it.
- Per-worktree resources
Configure external resources that discern creates, reuses, destroys, and reclaims with each worktree.
- Identity and environment
How every checkout gets stable names, a deterministic port and test seed, inherited env values, and discoverable resource handles.
- Parallel and team work
How people and agents share a repository while each change stays in its own worktree and branch.
- Awaiting the fleet
Block until a sibling branch is green, its work lands, or the trunk moves, using a held call instead of guessed polling.
- Multi-repo workspaces
Configure discern across sibling repositories, from local package links and registries to umbrella repos and submodules.
- Status and session hints
Read the current worktree or fleet dashboard and its next actions without running the Gate.
- The desk
Start work, open configured coding agents, and supervise every active worktree from discern's interactive fleet view.
- Open another worktree
Choose another checkout and open a child shell at the matching project-relative directory.
- Desk tips
A deterministic teaching line per Desk session, including what it shows, how it is chosen, and where its record lands.
- Landing authority
How conversation consent and recorded grants decide whether a submitted commit returns for review or lands directly.
- Interrupted landing recovery
How discern completes or rolls back an interrupted acceptance without replaying authority or overwriting changed checkout data.
- Hand work back
Finish a branch, report its Proof for review, wait for approval, and accept the same validated commit.
- Reclaiming contained worktrees
Prune and the Desk offer to reclaim spent train stages whose commits travel inside a live branch while keeping their branch refs.
- Cleanup ownership and teardown
How automatic cleanup proves a worktree belongs to discern and verifies that its checkout is gone.
- Reappeared worktree paths
How discern reports and safely cleans files an external program writes into a worktree path after removal.
- Recover a dropped branch
Restore committed work after discern removes a worktree branch.
- Emergency integration
Review and record an explicit local integration before required machine validation finishes.
Agent instructions
Author one set of project instructions, compile it for every coding agent, and keep the generated files current.
- Write project instructions
Configure instruction sources and write project rules that every supported coding agent can follow.
- Compile and check instructions
Run refresh, inspect the agent files, and keep every configured agent on the current sources.
Skills
Use discern's bundled playbooks, add project-specific ones, customize the set, and preserve lessons from agent sessions.
- What a Skill is
How Skills give agents task-matched procedures, and when to use one instead of instructions, a script, or documentation.
- Bundled Skills
The registry-checked catalog of task playbooks bundled with discern and materialized for coding agents.
- Author a Skill
Create a project-specific SKILL.md, make its trigger discoverable, and materialize it for every configured agent.
- Customize or exclude Skills
Eject a bundled Skill into project ownership, override by name, or exclude a bundled or authored Skill from materialization.
- Teach the project
Capture a durable lesson from an agent session in instructions, a Skill, a checkpoint, a script, documentation, or an ADR.
Engine internals
The dispatcher and the TypeScript modules every built-in verb uses.
- Config access
How one schema, one paths registry, and one comment-preserving writer read, resolve, and edit discern.toml.
- The document model
One neutral model in src/lib/docs.ts backs every reader of a documentation tree: discern map, discern docs (terminal and Model Context Protocol, or MCP), exports, the docs site, and its search and machine-readable derivations. The shared model discovers, orders, resolves, searches, and renders Markdown without deciding whether it is reading a configured project map or discern's product manual. src/lib/manual.ts applies the repository manual's closed corpus policy. This is one document engine with two policy models (ADR 0314).
- Local durable formats
Find the authority for versioned Git-admin records and apply the forward-version rule.
- Migration mechanics
How schema changes advance installed projects while preserving config validity and project-owned content.
- Result contracts and protocol adapters
How result vocabulary, Zod schemas, generated contracts, and protocol validation stay synchronized.
- Emitting output from a new verb
The one blessed pattern for narration lines, groups, aligned listings, and errors with recovery.
- Instruction template engine
The strict config-only renderer for bundled instructions and bundled-skill Markdown.
- The Logbook
The local, metadata-only record of discern's verb starts and completions, including storage, config epochs, and readers.
- Process output and exit boundaries
Locate the exact adapters that may write process streams or terminate the product process.
- Promise effect ownership
Sequence promise-like effects or transfer them to an exact lifecycle boundary with synchronous rejection handling.
- Subprocess boundaries
Route ordinary spawns through the shared capability or an exact ratcheted registry.
- Experimental behaviors
Environment-only trials, their activation rules, and the current experiments.
- Operation effects and exclusion
How CLI and MCP command paths declare effects, choose a shared-state boundary, and refuse conflicting writers.
- Managed adoption
meta.managed_version answers which discern release last successfully adopted the project's managed material. Start with the shared classifier, then the transaction and evidence decision. The programme authority is ADR 0400.
Agent integrations
How discern configures instructions, Skills, MCP, hooks, trust, and worktrees for each supported coding agent.
- Claude Code
How discern configures instructions, Skills, MCP, hooks, trust, and worktrees for Claude Code.
- Codex
How discern configures instructions, Skills, MCP, hooks, worktree setup, and Git rules for Codex.
- Gemini
How discern configures instructions, shared Skills, MCP, hooks, and workspace trust for Gemini.
- Cursor
How discern configures instructions, Skills, MCP, hooks, trust, and worktrees for Cursor.
- GitHub Copilot
How discern configures shared instructions and Skills, MCP, hooks, and folder trust for GitHub Copilot.
Reference
Exact command, configuration, MCP, file-ownership, platform, environment, and identity contracts for discern.
- Result formats & delivery
Choose terminal, Markdown, JSON, or MCP delivery for one prepared DiscernResult.
- MCP tools & results
The public MCP tools, resources, DiscernResult envelope, generated schemas, and command exit-code contract.
- Compatibility policy
Where the public compatibility policy lives, which comparators, registries, and guards enforce it, and how members become evolving.
- Proof note format
The DSSE-compatible envelope attached to a landed commit, including its payload, signature boundary, and reading rules.
- Files & ownership
Every project path discern writes or maintains, its edit and overwrite contract, Git treatment, and uninstall behavior.
- The Logbook
What discern records about its own verb runs, where the files live, and how to read, archive, reset, or disable them.
- Crash reports
How discern reports unexpected internal errors across the CLI and MCP, where it saves local evidence, and what to attach to an issue.
- Platforms & prerequisites
Supported operating systems and architectures, required tools, identity selectors, and worktree command tokens.
- MCP call duration
How discern fits long-running tool calls inside each coding agent's MCP timeout.
- Progress & reconnect
How long operations report progress while they run, the producer progress protocol, and the handle that reads an operation back after a lost call.
- Temp files & retention
What discern writes to your OS temp directory, how long each file lives, where the self-shim resolves, and how everything leaves with the tool.
- Logbook lifecycle
How owners preview and confirm archive or reset, how sealed history stays recoverable, and how reports select it.
- Checkpoint state & declarations
The checkpoint open question states, the declaration and variance flags, and the surfaces that report them.
- Checkpoint when protocol
The versioned DISCERN_CHECKPOINT_INPUT facts, DISCERN_MATCH output, lifecycle, and candidate-worktree execution boundary.
- Setup command boundaries
Owner consent, point-in-time write checks, resumable phases, and provider activation during setup.
- Worktree setup-step recovery
Journal states and owner-confirmed choices for an interrupted project-authored setup command.
Working on this project
How contributors set up the checkout, change code, run the checks, and prepare a release.
- Ambient process state
Where authored code may consult the host process, and how deeper code receives those values.
- Gate gotchas
Recovery for discern done failures whose immediate diagnostic needs more context. The routine gate procedure lives in getting-started.md and code-conventions.md.
- Install surface
The engineering inventory of every project-tree path discern writes or maintains, derived from the same registries as the write boundary.
- Maintenance
Use measured evidence to remove unreachable code, incidental repetition, and concentrated responsibilities without distorting ownership to improve a number.
- For humans
The prerequisites, editor settings, and maintainer actions used alongside coding-agent work in this repository.
- Getting started
Cloning, setting up, and running the project locally for the first time.
- Canonical sets
Locate the membership authorities whose consumers must enroll new members automatically.
- Testing
How this repository's tests are written, how they run, and which patterns the gate requires.
- Compose terminal applications
Run a package-owned application through discern's process and interaction boundaries, and choose the appropriate testing seam.
- Review terminal output
Capture a real discern command at a fixed terminal size, inspect its visual browser rendering, and hand the rendered evidence to review.
- Canon Editor
Canon Editor edits the prose registries on their generated pages and proves every save with the canons' guards.
- Code conventions
The rules the tooling enforces, and the conventions to follow when writing code here.
- Runtime data boundaries
How files, subprocess output, caches, and other external values earn the TypeScript types discern uses.
- Duplication census
Read discern's clone-group evidence and reduce the repository's held duplicate-line total.
- Test execution review
Each expensive test execution should establish a necessary state, exercise a necessary boundary, or observe a distinct transition. A shared helper removes source duplication; calling that helper for every assertion can still repeat expensive work.
The public site — discern.sh
The public pages for discern live in this repository, so the gate checks the site and the engine together (ADR 0129). This subtree is for contributors. The product manual lives under project/manual/; the public map is a separately framed projection of this configured map.
- Release records and comparison
The release site answers from authored Markdown records and a validated publication snapshot. ADR 0400 governs the programme, including later CLI, desk, reminder, adoption, and installer work.
- Authoring site pages
Start in site/ui/pages/ for a React page and site/ui/layouts/ for its shared structure. Document.tsx owns the document head, theme bootstrap, and assets. site/ui/components/ holds thin product adapters over the exact published design system. Page-specific styles and progressive enhancements live in site/page-src/; shared browser assets remain authored in site/pages/assets/.
- Design-system consumption
The site's React pages live in site/ui/. Marketing pages render at build time; Releases and the map directory render on the server. Their shared document and layout components use the package's typed React adapters. The browser receives HTML, CSS, and explicit progressive enhancements, with no hydration (ADR 0402). See Authoring site pages for editing locations and the server/browser distinction.
- Publishing the site
The site consists of one fetch handler and static files. Publishing runs that handler at a public address. Local and production both run site/serve.ts, so the local preview uses the production rendering path.
- The design-system dependency
discern uses one exact @discern-sh/design-system alias. It resolves to an immutable JavaScript Registry (JSR) release through the committed Deno lock. Ordinary commands need no package checkout. The discern-sh/design-system repository authors and releases the package. This repository owns the discern.sh integration and product compositions.
- The docs section
/docs is the authored product manual. /map is a directory of the configured project map, with entries hosted in the source repository. The corpora share neutral discovery and publication primitives while keeping separate reader promises (ADR 0314, ADR 0403).