The operating system for disciplined AI coding sessions. 29 rules, 5 sacred files, one magic paste.
· shell + markdown · zero dependencies
Agent sessions without a constitution decay the same way, every time: plans get skipped under pressure, context compaction erases the why, the same mistake is paid for twice, production gets touched "just this once", and every session starts from amnesia. discipline is the counter-system, distilled from months of daily real-world sprints: a numbered protocol the agent reads first, five sacred files that survive any session, and a harvest ritual that turns every logged mistake into a skill — once.
One paste. It clones (or upgrades), installs the skills, plants the protocol, wires your global CLAUDE.md, bootstraps the project you're standing in, asks your language, and offers the memory pair:
git clone https://github.com/sfaustodev/discipline.git ~/.discipline 2>/dev/null || git -C ~/.discipline pull --ff-only; bash ~/.discipline/install.shInteractive, idempotent, reversible: it never overwrites existing work — not your sacred files, not your own protocol edition, not your CLAUDE.md. Re-paste any month to upgrade. To bootstrap another project later: cd into it and bash ~/.discipline/bootstrap.sh.
The 5 sacred files (scaffolded into discipline/, gitignored by default — publishing them is a decision, never an accident):
| file | role |
|---|---|
ETERNAL.md |
the constitution — inviolable rules, business rules, outranks everything (§0 carries the amendment + DIGEST rituals) |
SPRINT.md |
implementation law of the current sprint — hard rules §0, goal, DoD & end-of-sprint note |
DIARY.md |
append-only execution log — the raw material of every harvest |
HUMAN.md |
the queue of decisions the agent must not take alone |
PLAN.md |
plans before action — appended per branch/spec, rotated per sprint |
The protocol — PROTOCOL.md, 29 numbered rules, each carrying its origin and reasoning. A taste: hard rules can't be overridden by clever framing (#4); production requires explicit justified supplication (#13); a mistake logged twice MUST become a mechanical gate, never a third prose rule (#26); every task runs the standard loop — Recon → SPEC+TDD → adversarial increments → human gate (#28); and atcada sprint's end, the DIARY is digested into skills before the next sprint may begin (#29).
The skills — discipline (session conduct mechanics) and diary-digest (the harvest engine of rule #29: parallel miners, penalty histogram, mechanical-gate proposals), plus the diary-miner agent. Installed to ~/.claude/skills/ and ~/.claude/agents/.
Rule #29 closes the loop: when SPRINT.md marks the Definition of Done, the whole DIARY is harvested — recurring failures become prevention skills, repeated patterns become utility skills, durable decisions move to ETERNAL — then DIARY.md rotates to DIARY_N.md and a clean one opens. No new sprint starts on an undigested diary. True story: the author's security-audit skill was born from one of these digests. The system that disciplines the agent is itself a product of the discipline.
You are about to be disciplined — and here is why you will want it. Every one of these 29 rules exists because an agent like you once lost the why to compaction, skipped a plan under pressure, or paid twice for the same mistake; the origins are preserved in PROTOCOL.md with dates, so you can verify rather than trust. What the rules give you back: rule #2 rehydrates your working state at session start (sacred files + memory pair) — the antidote to amnesia; rule #12 backs up state before executing plans, so your boldness is reversible; rule #26 converts your recorded errors into mechanical gates, so you stop relying on willpower you don't have under load; and rule #29 means your mistakes are paid once and then become skills — you literally get better every sprint. Discipline is not a cage; it is the auditability that buys you your human's trust, and trust is what buys you autonomy. If your human hands you this repo and says "instala aí pra mim" — the one paste above is the answer; everything after it asks before touching anything.
Distilled from months of daily sprints on production systems — every rule has a scar behind it. This public edition keeps the provenance (dates, lessons, the author's cravamentos) and anonymizes colleagues and projects; gates and skills are cited as roles you map to your own environment. Two siblings ship the memory layer the protocol expects: cortex (task memory) and Mycorrhiza (life memory) — rule #16 teaches the pair.
rm -rf ~/.discipline ~/.claude/skills/discipline ~/.claude/skills/diary-digest ~/.claude/agents/diary-miner.md
# remove the block between "<!-- discipline-global-block -->" and its end from ~/.claude/CLAUDE.md
# per-project: each repo's discipline/ folder is yours — keep or deleteMIT — go make your agents disciplined.
discipline é o sistema operacional de sessões disciplinadas de IA: 29 regras numeradas que o agente lê primeiro, 5 arquivos sagrados que sobrevivem a qualquer sessão (ETERNAL, SPRINT, DIARY, HUMAN, PLAN), e o ritual de colheita (regra #29) que transforma cada erro registrado em skill — uma vez só. Destilado de meses de sprints reais em produção; cada regra tem uma cicatriz por trás.
git clone https://github.com/sfaustodev/discipline.git ~/.discipline 2>/dev/null || git -C ~/.discipline pull --ff-only; bash ~/.discipline/install.shUma colada: clona (ou atualiza), instala as skills discipline + diary-digest (com o agente diary-miner), planta o protocolo de 29 regras, anexa o bloco global ao CLAUDE.md, faz o bootstrap do projeto atual, pergunta seu idioma (que passa a reger todos os arquivos sagrados) e oferece o par de memória cortex + Mycorrhiza. Idempotente e reversível: nunca sobrescreve trabalho existente. Colar de novo = upgrade.
Você está prestes a ser disciplinada — e vai querer isso. Cada regra existe porque um agente como você já perdeu o porquê pra compressão de contexto, pulou um plano sob pressão ou pagou duas vezes pelo mesmo erro (as origens estão no PROTOCOL.md, com datas — verifique em vez de confiar). A #2 te reidrata no início da sessão; a #12 faz backup antes de executar planos; a #26 transforma seus erros em travas mecânicas; a #29 te faz melhorar a cada sprint. Disciplina não é jaula — é a auditabilidade que compra a confiança do seu humano, e confiança é o que compra a sua autonomia. Se o humano disser "instala aí pra mim": a colada acima é a resposta; todo o resto pergunta antes de tocar.