How darkwingtm/claude-code-rules works
1. What this repository is
- This is a governed rules/framework repository for Claude Code, not an application backend.
- Its job is to define assistant behavior through Markdown-based policy, execution, documentation, and validation artifacts.
2. Primary runtime payload
- The live install target is a compact set of 18 active root rule files.
- These are copied into a project’s .claude/rules/ directory and form the runtime behavior surface.
- The runtime set is intentionally separate from the larger documentation, phase, changelog, and playground surfaces.
3. Core behavioral layers
- The runtime rules are grouped into four main subsystems:
- Safety and authority: authority-and-scope, action-safety, refusal-and-recovery, evidence-discipline
- Communication and presentation: accurate-communication, communication-register, explanation-and-presentation, audience-surface-disclosure-control
- Execution and coordination: coding-discipline, execution-and-goal-frame, worker-routing-and-context, phase-todo-artifact
- Governance and context: document-governance, document-integrity, safe-io, external-verification-and-source-trust, memory-governance-and-session-boundary, portable-implementation-and-hardcoding-control
4. Source-of-truth hierarchy
- design/*.design.md defines intended target behavior.
- Root *.md rule files define the active runtime behavior.
- changelog/ records versioned synchronization history.
- TODO.md, phase/, and patch/ carry execution state, phased work, and review/change artifacts.
- This makes the repo a controlled documentation system with clear authority separation.
5. Install and deployment path
- The operator entrypoint is script/launcher.sh and script/launcher.ps1.
- The helper installers perform the actual copy/sync work into the target project’s .claude/rules/.
- The install model is launcher-first, project-local by default, and deliberately scoped to Claude Code.
6. Ownership and cleanup boundary
- Cleanup is manifest/owner-aware, not filename-wildcard based.
- The repo removes only its own previously installed runtime files when they still match the recorded install snapshot.
- Files already present in the destination but not proven to belong to this repo are preserved by default.
- That boundary is a major architectural constraint: it protects shared .claude/rules/ folders from collateral deletion.
7. Lifecycle and documentation topology
- done/ and history/ folders are used to compact older material out of the active scan path:
- changelog/done/
- phase/done/
- phase/history/
- todo/history/
- todo/done/
- Active documents stay small and current; completed detail is archived without being treated as junk.
- There is no default design/done/ pattern, because design remains the active blueprint authority.
8. Phase planning subsystem
- phase/SUMMARY.md is the live index for phased work.
- phase/phase-NNN-*.md and phase/phase-NNN-NN-*.md hold major-phase and subphase execution detail.
- phase-todo-artifact.md acts as the startup posture gate that decides whether a phase, TODO, patch, or design companion is needed.
- This subsystem turns governed design into staged execution rather than ad hoc task notes.
9. Changelog subsystem
- changelog/changelog.md is the repository-level synchronization authority.
- Each active chain has an authoritative parent changelog, with version detail shards stored under nested chain folders when needed.
- The changelog layer tracks release/version state separately from runtime rules, so history does not become the runtime contract.
10. Playground subsystem
- playground/ is a governed but non-runtime validation and scenario area.
- It contains cases, coverage mapping, a matrix, and observed examples for behavior exploration.
- It is explicitly excluded from the .claude/rules/ install payload.
11. Operational verification model
- The repo emphasizes evidence-first behavior, runtime parity, body sufficiency, and controlled release verification.
- The architecture is meant to keep claims, docs, runtime files, and install output aligned.
- GitHub releases and tagged version history are part of the publication/verification story, but the actual operational surface remains the Markdown rule set plus the installer scripts.
Main entry points: runtime-architecture.design.md Runtime arch · setup-claude-code-rules.sh Setup sync · design.md Design specs · verification-and-integration.design.md Verification
Components 20
Runtime rules
Active Markdown rules that form the installable Claude Code behavior surface.
- Authority & scope · Defines boundaries, ownership, and who may act on what.
authority-and-scope.md - Safety & refusal · Covers action safety, refusal, recovery, and safe I/O behavior.
action-safety.md - Evidence & comms · Controls evidence discipline, communication register, and presentation style.
evidence-discipline.md - Execution frame · Sets coding discipline, goal framing, and worker routing for active work.
execution-and-goal-frame.md - Doc governance · Manages document authority, integrity, memory, and portable implementation constraints.
document-governance.md
Governance docs
Design, changelog, and integrity documents that define and track intended behavior.
- Design specs · Target-behavior source of truth under design/*.design.md.
design/design.md - Runtime arch · Defines the active runtime rule surface and how it is composed.
design/design/runtime-architecture.design.md - Installer arch · Defines launcher-first install and sync behavior into project-local Claude Code rules.
design/design/installer-architecture.design.md - Repo model · Explains the repository’s layered authority model and content surfaces.
design/design/repository-model.design.md - Verification · Defines parity, evidence, and release verification expectations.
design/design/verification-and-integration.design.md - Changelog root · Repository-level synchronization authority for versioned behavior changes.
changelog/changelog.md
Execution state
Phase, TODO, and patch artifacts that stage and record governed work.
- Phase index · Live index of phased work and staged execution paths.
phase/SUMMARY.md - Phase tasks · Major-phase and subphase work items that drive governed changes.
phase/phase-001-01-create-tactical-strategic-rule.md - TODO · Current operational task surface and handoff boundary.
TODO.md - Patches · Review and change companions that capture concrete edits and transitions.
patch/active-runtime-body-sufficiency-corrective-validation.patch.md
Validation area
Playground scenarios and observed examples used to test behavior.
- Playground cases · Governed but non-runtime scenarios for behavior exploration and coverage.
playground/cases/case-01-authority-collision-resolver.md - Coverage matrix · Maps scenarios, coverage, and observed behavior in the playground.
playground/matrix.md - Observed examples · Captured scenario observations used to validate rule behavior.
playground/observed/2026-05.md
Install tooling
Launcher and setup scripts that sync the rules into project-local Claude Code paths.
- Launcher · Primary operator entrypoint for syncing rules into a target project.
script/launcher.sh - Setup sync · Copies and synchronizes the governed rule set into .claude/rules/.
script/setup-claude-code-rules.sh
Connections 29
- Design specs → Runtime arch: defines · Blueprints the intended runtime rule architecture.
- Design specs → Installer arch: defines · Blueprints the install and sync architecture.
- Design specs → Repo model: defines · Defines the repository’s layered authority model.
- Design specs → Verification: defines · Defines verification and parity expectations.
- Runtime arch → Authority & scope: shapes · Sources the runtime authority boundary rule.
- Runtime arch → Safety & refusal: shapes · Sources safety, refusal, and recovery rules.
- Runtime arch → Evidence & comms: shapes · Sources evidence and presentation rules.
- Runtime arch → Execution frame: shapes · Sources execution and routing rules.
- Runtime arch → Doc governance: shapes · Sources document integrity and memory governance rules.
- Changelog root → Runtime arch: records · Tracks synchronized rule changes and releases.
- Changelog root → Design specs: tracks · Tracks authority changes to design intent.
- Phase index → Phase tasks: indexes · Indexes the live phase work chain.
- Phase tasks → TODO: feeds · Turns phase work into current operational tasks.
- Phase tasks → Patches: produces · Generates change artifacts and review companions.
- TODO → Phase index: aligns · Keeps current work tied to the active phase structure.
- Coverage matrix → Playground cases: maps · Maps coverage onto scenario cases.
- Playground cases → Observed examples: captures · Produces observed behavior examples.
- Verification → Coverage matrix: uses · Uses validation coverage and scenario mapping.
- Verification → Launcher: checks · Verifies install/runtime parity through the launcher path.
- Launcher → Setup sync: delegates · Operator entrypoint delegates to install synchronization helpers.
- Setup sync → Authority & scope: installs · Copies active runtime rules into the project-local rules surface.
- Setup sync → Safety & refusal: installs · Copies active safety and refusal rules.
- Setup sync → Evidence & comms: installs · Copies active communication and evidence rules.
- Setup sync → Execution frame: installs · Copies active execution and routing rules.
- Setup sync → Doc governance: installs · Copies active governance and integrity rules.
- Installer arch → Setup sync: specifies · Defines the helper installer behavior.
- Repo model → Phase index: bounds · Separates active execution state from other documentation surfaces.
- Repo model → Playground cases: excludes · Keeps playground scenarios out of the runtime install payload.
- Verification → Changelog root: audits · Uses changelog state for release and parity checks.