gator-command 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gator_command/__init__.py +2 -0
- gator_command/cli.py +137 -0
- gator_command/scripts/crawler.py +633 -0
- gator_command/scripts/dashboard/dashboard.css +982 -0
- gator_command/scripts/dashboard/dashboard.html +84 -0
- gator_command/scripts/dashboard/dashboard.js +419 -0
- gator_command/scripts/dashboard/views/audit.js +270 -0
- gator_command/scripts/dashboard/views/fleet.js +307 -0
- gator_command/scripts/dashboard/views/repo.js +599 -0
- gator_command/scripts/dashboard/views/settings.js +173 -0
- gator_command/scripts/dashboard/views/updates.js +308 -0
- gator_command/scripts/enforcer-prompt.md +22 -0
- gator_command/scripts/extract-claude-sessions.py +489 -0
- gator_command/scripts/extract-codex-sessions.py +477 -0
- gator_command/scripts/extract-gemini-sessions.py +410 -0
- gator_command/scripts/gator-audit.py +956 -0
- gator_command/scripts/gator-charter-draft.py +919 -0
- gator_command/scripts/gator-charter-lint.py +427 -0
- gator_command/scripts/gator-charter-verify.py +606 -0
- gator_command/scripts/gator-dashboard.py +1271 -0
- gator_command/scripts/gator-deploy.py +916 -0
- gator_command/scripts/gator-drift.py +569 -0
- gator_command/scripts/gator-enforce.py +82 -0
- gator_command/scripts/gator-fleet-intel.py +460 -0
- gator_command/scripts/gator-fleet-report.py +615 -0
- gator_command/scripts/gator-init-command-post.py +315 -0
- gator_command/scripts/gator-init.py +434 -0
- gator_command/scripts/gator-machine-id.py +153 -0
- gator_command/scripts/gator-policy-status.py +631 -0
- gator_command/scripts/gator-pulse.py +459 -0
- gator_command/scripts/gator-repo-status.py +649 -0
- gator_command/scripts/gator-session-common.py +372 -0
- gator_command/scripts/gator-session-sink.py +831 -0
- gator_command/scripts/gator-sessions.py +1244 -0
- gator_command/scripts/gator-update.py +615 -0
- gator_command/scripts/gator-version.py +38 -0
- gator_command/scripts/gator_core.py +489 -0
- gator_command/scripts/gator_remote.py +381 -0
- gator_command/scripts/gator_runtime.py +142 -0
- gator_command/scripts/gatorize-actions.sh +989 -0
- gator_command/scripts/gatorize-lib.sh +166 -0
- gator_command/scripts/gatorize-post.sh +394 -0
- gator_command/scripts/gatorize.py +1163 -0
- gator_command/scripts/gatorize.sh +185 -0
- gator_command/scripts/generate_markdown.py +212 -0
- gator_command/scripts/generate_wiki.py +424 -0
- gator_command/scripts/graph_health.py +780 -0
- gator_command/scripts/memex-lint.py +286 -0
- gator_command/scripts/memex-lint.sh +205 -0
- gator_command/scripts/memex.py +1472 -0
- gator_command/scripts/memex_formatters.py +191 -0
- gator_command/scripts/memex_state.py +236 -0
- gator_command/scripts/spawn.py +650 -0
- gator_command/templates/gator-starter/blueprints/README.md +32 -0
- gator_command/templates/gator-starter/charterignore +53 -0
- gator_command/templates/gator-starter/charters/README.md +178 -0
- gator_command/templates/gator-starter/charters/_template.md +31 -0
- gator_command/templates/gator-starter/commands/commit.md +33 -0
- gator_command/templates/gator-starter/commands/init.md +11 -0
- gator_command/templates/gator-starter/commands/update.md +5 -0
- gator_command/templates/gator-starter/constitution.md +165 -0
- gator_command/templates/gator-starter/field-guides/README.md +25 -0
- gator_command/templates/gator-starter/gator-start-up.md +119 -0
- gator_command/templates/gator-starter/procedures/charter-alignment.md +83 -0
- gator_command/templates/gator-starter/procedures/enforcer-review.md +317 -0
- gator_command/templates/gator-starter/procedures/field-guide-generation.md +176 -0
- gator_command/templates/gator-starter/procedures/knowledge-capture.md +57 -0
- gator_command/templates/gator-starter/procedures/significance-check.md +69 -0
- gator_command/templates/gator-starter/reference-notes/concierge-responses.md +535 -0
- gator_command/templates/gator-starter/reference-notes/dangerous-patterns.md +91 -0
- gator_command/templates/gator-starter/reference-notes/dashboard-operations.md +22 -0
- gator_command/templates/gator-starter/reference-notes/enforcer-configuration.md +232 -0
- gator_command/templates/gator-starter/reference-notes/example-project.md +289 -0
- gator_command/templates/gator-starter/reference-notes/failure-modes-and-self-correction.md +72 -0
- gator_command/templates/gator-starter/reference-notes/git-workflow.md +60 -0
- gator_command/templates/gator-starter/reference-notes/identity-and-ownership.md +37 -0
- gator_command/templates/gator-starter/reference-notes/refactor-approach.md +155 -0
- gator_command/templates/gator-starter/reference-notes/what-gator-requires-from-a-model.md +108 -0
- gator_command/templates/gator-starter/reference-notes/why-navigation-coding-feels-different.md +99 -0
- gator_command/templates/gator-starter/reference-notes/workflow-profiles.md +155 -0
- gator_command/templates/gator-starter/scripts/__pycache__/enforcer-review.cpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/__pycache__/gator-approve.cpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/__pycache__/gator-init.cpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/__pycache__/gator-pre-commit.cpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/__pycache__/gator-update.cpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/enforcer-prompt.md +55 -0
- gator_command/templates/gator-starter/scripts/enforcer-review.py +1551 -0
- gator_command/templates/gator-starter/scripts/gator-approve.py +139 -0
- gator_command/templates/gator-starter/scripts/gator-enforce.py +82 -0
- gator_command/templates/gator-starter/scripts/gator-init.py +434 -0
- gator_command/templates/gator-starter/scripts/gator-pre-commit.py +2670 -0
- gator_command/templates/gator-starter/scripts/gator-pulse.py +459 -0
- gator_command/templates/gator-starter/scripts/gator-update.py +615 -0
- gator_command/templates/gator-starter/scripts/gator-version.py +38 -0
- gator_command/templates/gator-starter/scripts/gator_core.py +487 -0
- gator_command/templates/gator-starter/scripts/hooks/__pycache__/commit-msgcpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/hooks/__pycache__/post-commitcpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/hooks/__pycache__/pre-commitcpython-313.pyc +0 -0
- gator_command/templates/gator-starter/scripts/hooks/commit-msg +5 -0
- gator_command/templates/gator-starter/scripts/hooks/post-commit +7 -0
- gator_command/templates/gator-starter/scripts/hooks/pre-commit +5 -0
- gator_command/templates/gator-starter/sessions/.gitignore +7 -0
- gator_command/templates/gator-starter/vault/.gitkeep +0 -0
- gator_command/templates/gator-starter/whiteboard.md +5 -0
- gator_command-1.0.0.dist-info/METADATA +122 -0
- gator_command-1.0.0.dist-info/RECORD +110 -0
- gator_command-1.0.0.dist-info/WHEEL +5 -0
- gator_command-1.0.0.dist-info/entry_points.txt +2 -0
- gator_command-1.0.0.dist-info/licenses/LICENSE +21 -0
- gator_command-1.0.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# .charterignore — files and directories excluded from charter work.
|
|
2
|
+
# Uses gitignore-style glob patterns. Lines starting with # are comments.
|
|
3
|
+
# This file lives at .gator/.charterignore
|
|
4
|
+
|
|
5
|
+
# Tests
|
|
6
|
+
tests/
|
|
7
|
+
test/
|
|
8
|
+
__tests__/
|
|
9
|
+
*_test.py
|
|
10
|
+
*_test.go
|
|
11
|
+
*_test.js
|
|
12
|
+
**/*_spec.rb
|
|
13
|
+
**/conftest.py
|
|
14
|
+
|
|
15
|
+
# Build and vendor
|
|
16
|
+
dist/
|
|
17
|
+
build/
|
|
18
|
+
node_modules/
|
|
19
|
+
vendor/
|
|
20
|
+
__pycache__/
|
|
21
|
+
*.pyc
|
|
22
|
+
|
|
23
|
+
# Generated / minified
|
|
24
|
+
**/*.min.js
|
|
25
|
+
**/*.min.css
|
|
26
|
+
**/*.generated.*
|
|
27
|
+
|
|
28
|
+
# Config and metadata (not production logic)
|
|
29
|
+
setup.py
|
|
30
|
+
setup.cfg
|
|
31
|
+
pyproject.toml
|
|
32
|
+
package.json
|
|
33
|
+
package-lock.json
|
|
34
|
+
tsconfig.json
|
|
35
|
+
Makefile
|
|
36
|
+
Dockerfile
|
|
37
|
+
docker-compose.yml
|
|
38
|
+
*.toml
|
|
39
|
+
*.ini
|
|
40
|
+
*.cfg
|
|
41
|
+
|
|
42
|
+
# Documentation (charters cover code, not docs)
|
|
43
|
+
docs/
|
|
44
|
+
*.md
|
|
45
|
+
|
|
46
|
+
# IDE and environment
|
|
47
|
+
.vscode/
|
|
48
|
+
.idea/
|
|
49
|
+
.env
|
|
50
|
+
.env.*
|
|
51
|
+
|
|
52
|
+
# Gator internals
|
|
53
|
+
.gator/
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Charters
|
|
2
|
+
|
|
3
|
+
Charters are the comprehension layer for AI-assisted software development. They solve a specific problem: when AI generates code faster than a human can review it, the human loses architectural control — unless there's a structural layer that preserves comprehension at the speed code is now produced.
|
|
4
|
+
|
|
5
|
+
This folder contains both the philosophy (this document) and the working charters for this project. Point an LLM here and it gets everything: *why* charters exist, *how* they work, the notation system, and real examples it can study and replicate.
|
|
6
|
+
|
|
7
|
+
**Source**: "Constitutional Architecture for AI-Assisted Software Development" (Cumberland Laboratories, 2026)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## The Problem
|
|
12
|
+
|
|
13
|
+
The bottleneck in AI-assisted development is not code generation. Models are good at writing code. The bottleneck is *comprehension* — the human's ability to understand, evaluate, and direct the system they're nominally in charge of.
|
|
14
|
+
|
|
15
|
+
Before LLMs, code and comprehension scaled together: you wrote it, so you understood it. AI breaks that coupling. Code volume grows without a corresponding growth in human understanding. The developer becomes a reviewer of output they didn't write, in a codebase that's growing faster than they can read.
|
|
16
|
+
|
|
17
|
+
This is not a tooling problem. It's a governance problem. The same problem organizations faced when they grew beyond the size where everyone could know everything: you need institutional structures — constitutions, charters, separation of powers — not smarter individuals.
|
|
18
|
+
|
|
19
|
+
## The Inversion
|
|
20
|
+
|
|
21
|
+
Traditional documentation describes code. You write the code first, then document it. The documentation is secondary, the code is primary.
|
|
22
|
+
|
|
23
|
+
Charters invert this relationship.
|
|
24
|
+
|
|
25
|
+
The charter network — function signatures, access patterns, cross-references, tripwires — is the primary artifact the human works with. It's the layer where architectural decisions are legible, where you can reason about the system without reading every file. The code is the *implementation* of what the charters describe. AI reads the code; humans read the charters; the charters keep them synchronized.
|
|
26
|
+
|
|
27
|
+
## Session Zero
|
|
28
|
+
|
|
29
|
+
Every reader — human or LLM — arrives at a codebase with zero history. They don't know why a function exists, what invariants it assumes, or which design decisions look wrong but are intentional.
|
|
30
|
+
|
|
31
|
+
Code alone doesn't fix this. Code tells you *what* the system does. It doesn't tell you *why* it's shaped this way, *what state it reads and writes*, or *what the system deliberately doesn't do*. These are the things that matter most when you're about to make a change, and they're invisible in the source.
|
|
32
|
+
|
|
33
|
+
Charters surface what cannot be inferred from reading code:
|
|
34
|
+
|
|
35
|
+
- **Access patterns**: what a function reads and writes — models, session state, caches, external APIs — so you can predict side effects without reading the body
|
|
36
|
+
- **Dependency direction**: what calls this function (`←`) and what it calls (`→`) — so you know what breaks when you change it
|
|
37
|
+
- **Tripwires**: the non-obvious patterns that *must* be preserved — rendering dualities, race conditions, intentional workarounds that look like bugs
|
|
38
|
+
- **Negative space**: what the system deliberately lacks, stated explicitly to prevent false assumptions
|
|
39
|
+
|
|
40
|
+
That last point matters especially for LLMs. A model's training data creates priors about what systems "should" have. If your system intentionally omits error retry, or deliberately uses a naive algorithm, the model will "fix" it unless the charter says otherwise. Negative space documentation corrects false priors before they become false code.
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## The Notation
|
|
45
|
+
|
|
46
|
+
Each charter covers a code module. Each *function* within that module gets its own block:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
### apply_grade(submission, raw_score, grader)
|
|
50
|
+
File: core/utils/grading.py
|
|
51
|
+
Creates Grade record with penalty-adjusted score.
|
|
52
|
+
Models: Submission(R), Grade(W), Enrollment(RW)
|
|
53
|
+
Session R: current_grader_id, active_rubric
|
|
54
|
+
Session W: last_graded_at
|
|
55
|
+
← grade_submission() in views_assignments
|
|
56
|
+
→ see cross_cutting.md "Late Penalty Timing"
|
|
57
|
+
! The instructor sees raw_score, but Grade.score
|
|
58
|
+
is penalty-adjusted. These are different numbers.
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
| Symbol | Meaning | Why it exists |
|
|
62
|
+
|--------|---------|---------------|
|
|
63
|
+
| `function_name()` | Function heading | Greppable identifier — the agent finds the current location via `grep -rn "def function_name"`. Survives code churn without maintenance. |
|
|
64
|
+
| `(R)/(W)/(RW)` | Access pattern | Predicts side effects without reading code — `(R)` is safe to call, `(RW)` requires checking downstream effects |
|
|
65
|
+
| `!` | Tripwire | Inverts the reader's assumption — contradiction spikes LLM attention at the point of maximum relevance |
|
|
66
|
+
| `→` | Outbound cross-reference | "This function depends on..." — follow to understand downstream effects |
|
|
67
|
+
| `←` | Inbound cross-reference | "This function is called by..." — follow to understand blast radius |
|
|
68
|
+
| `Session R:` / `Session W:` | State access | Tracks untyped state (session dicts, Redis keys) that code analysis alone can't reveal |
|
|
69
|
+
| `TRIPWIRE` | Section-level danger label | Flags architectural patterns that span multiple functions and must be preserved as a unit |
|
|
70
|
+
|
|
71
|
+
**Why function names, not line numbers:** An earlier version of this notation used `[Lnnn]` line anchors. These break on every edit above them, creating combinatorial maintenance overhead. Function names are structurally stable — they survive code churn, they're self-verifying via grep, and they match how LLM agents actually navigate code. The staleness signal is cleaner too: a function name either resolves or visibly fails. A stale line number silently points to the wrong code.
|
|
72
|
+
|
|
73
|
+
## The Cross-Cutting Charter
|
|
74
|
+
|
|
75
|
+
The most important charter in any set. It doesn't map to a single code module — it maps to *patterns that span modules*.
|
|
76
|
+
|
|
77
|
+
Every codebase has behaviors that emerge from the interaction of multiple modules: a data flow that traverses four files, an implicit contract between a prompt and the code that parses its output, an invariant that must be preserved across every exit path. These patterns are invisible in any individual module's charter. They're the things that break during refactors — not because any single module was changed incorrectly, but because the *relationship* between modules was violated.
|
|
78
|
+
|
|
79
|
+
The cross-cutting charter documents these patterns with `TRIPWIRE` labels. In graph terms, it's a hub node — it connects tightly-clustered domain charters and dramatically improves navigability.
|
|
80
|
+
|
|
81
|
+
**What goes in the cross-cutting charter:**
|
|
82
|
+
- Multi-module data flows where changing one link breaks the chain
|
|
83
|
+
- Implicit contracts not encoded in any function signature
|
|
84
|
+
- Invariants that must be preserved across all code paths (e.g., "session must be saved on every exit")
|
|
85
|
+
- Patterns where two parallel implementations must stay synchronized (rendering dualities, cache/DB consistency)
|
|
86
|
+
- Stub inventories — scattered stubs connected by design decisions not yet finalized
|
|
87
|
+
|
|
88
|
+
**When to read it:** Always. Read the cross-cutting charter first, before the module-specific one.
|
|
89
|
+
|
|
90
|
+
## How Charters Were Used: A Validated Example
|
|
91
|
+
|
|
92
|
+
These charters were battle-tested on a 97K-line production Django codebase (20 charter files). They were created *before* a major refactor and served four roles:
|
|
93
|
+
|
|
94
|
+
1. **Navigation map**: every function, its access patterns, and its cross-module dependencies — so the agent could trace call chains without reading every file
|
|
95
|
+
2. **Dependency graph**: the `←` and `→` annotations show what calls what, so you know what will break when moving code
|
|
96
|
+
3. **Tripwire documentation**: the `!` annotations flag dangerous patterns that must be preserved during refactoring
|
|
97
|
+
4. **Invariant checking**: after moving code, verify that all charter-documented call paths still work
|
|
98
|
+
|
|
99
|
+
Three god-function decompositions were completed without regressions. A cross-module CSRF bug was identified via charter cross-references. The enforcer caught 4 stale charters in a single audit run.
|
|
100
|
+
|
|
101
|
+
## The Three-Layer Documentation Architecture
|
|
102
|
+
|
|
103
|
+
In a mature codebase, charters are one layer of a three-layer structure:
|
|
104
|
+
|
|
105
|
+
1. **Charters** — per-module API references. Every public function, what it reads/writes, what models it touches, session keys, cross-references, and tripwires. Organized by code structure. The machine-readable map.
|
|
106
|
+
2. **Designs** — flow-oriented user journey documents. Each one describes a complete business flow (checkout, authentication, quiz-taking) from the user's perspective, referencing charters for technical detail. Organized by what the user does.
|
|
107
|
+
3. **Systems** — infrastructure and subsystem documentation. How specific subsystems work (CI/CD, caching, rendering pipeline). Technical reference.
|
|
108
|
+
|
|
109
|
+
Charters are the ground truth. Designs are generated *from* charters as a more human-readable layer. Systems docs cover the infrastructure charters don't reach.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## When to Write Charters
|
|
114
|
+
|
|
115
|
+
- **At project start**: write skeleton charters alongside skeleton code. They force you to articulate module boundaries before writing implementations.
|
|
116
|
+
- **Before onboarding**: when someone new (human or LLM) will parachute into the codebase.
|
|
117
|
+
- **Before a refactor**: charters created before a refactor serve as navigation map, dependency graph, and invariant checklist during the work.
|
|
118
|
+
- **After a refactor**: module boundaries shift. Update charters to match the new reality, or they become misleading.
|
|
119
|
+
- **When an LLM will modify the code**: the charter is the most efficient way to give an LLM the "what goes where" knowledge it needs. It's cheaper than loading every source file into context.
|
|
120
|
+
|
|
121
|
+
## The Maintenance Obligation
|
|
122
|
+
|
|
123
|
+
Charters that fall out of sync with code are worse than no charters — a wrong map is more dangerous than no map. This is a structural obligation, not a suggestion.
|
|
124
|
+
|
|
125
|
+
The update chain: **code change → charter update → design doc update**. If you change a function's signature, access patterns, or cross-references, the charter must be updated in the same operation. Not "later." The charter is part of the change, the same way a migration is part of a schema change.
|
|
126
|
+
|
|
127
|
+
Because charters use function names (not line numbers), routine code edits that don't change function signatures or behavior don't require charter updates. The maintenance obligation triggers on: renamed functions, changed access patterns, new cross-module dependencies, or new tripwire-worthy behavior. This keeps the overhead proportional to architectural change, not code churn.
|
|
128
|
+
|
|
129
|
+
## Why Charters Are Especially Effective for LLMs
|
|
130
|
+
|
|
131
|
+
**Token efficiency.** A charter set compresses a 97K-line codebase into ~20 files of structured notation. The LLM gets the map without paying for the territory.
|
|
132
|
+
|
|
133
|
+
**Access pattern prediction.** `Models: Submission(R), Grade(W), Enrollment(RW)` tells the LLM exactly what a function mutates without reading a single line of the body. For session state — often an untyped dictionary with hundreds of references across dozens of files — `Session R:` / `Session W:` annotations are the *only* way to track state flow without loading every file.
|
|
134
|
+
|
|
135
|
+
**Tripwire attention.** The `!` notation exploits how models process text: contradiction spikes attention. When a charter says `! The instructor sees raw_score, but Grade.score is penalty-adjusted — these are different numbers`, the model's prediction is immediately corrected at the point of maximum relevance.
|
|
136
|
+
|
|
137
|
+
**Negative space correction.** Training-data priors are strong and often wrong for your specific system. A single line saying "no retry logic; failures are intentional signals" prevents the model from "improving" your design. The `TRIPWIRE` label on cross-cutting patterns tells the model "this looks wrong but it's not — preserve it."
|
|
138
|
+
|
|
139
|
+
## Sizing
|
|
140
|
+
|
|
141
|
+
Charters are a **small, intelligent map** — not a mirror of the code, but a compressed navigation layer. The goal is to fit the cross-cutting charter plus 1–2 module charters into context alongside the code being changed.
|
|
142
|
+
|
|
143
|
+
| Metric | Target | Warning sign |
|
|
144
|
+
|--------|--------|-------------|
|
|
145
|
+
| Lines per function entry | 3–5 | >8 lines means you're writing docs, not a map |
|
|
146
|
+
| Lines per charter | 30–80 | >100 lines means split into two domains |
|
|
147
|
+
| Total charter set | 3–6% of codebase | >10% means over-documenting; <1% means under-documenting |
|
|
148
|
+
| Charters per project | 3–8 typical | >12 means boundaries are too fine-grained |
|
|
149
|
+
|
|
150
|
+
**Measured ratios**: A 75K-line production Django app = 6% across 20 charter files. Smaller projects trend higher (a 700-line project might be 30%+ because the charters carry design intent that outweighs the code). The ratio is a calibration guide, not a hard rule. The real test: can the agent load the relevant charters alongside the code being changed?
|
|
151
|
+
|
|
152
|
+
## Anti-Patterns
|
|
153
|
+
|
|
154
|
+
- **Charter as API docs**: charters are about ownership, access patterns, and boundaries, not method signatures. If it reads like a docstring, it's too low-level.
|
|
155
|
+
- **Bloated charters**: if a charter exceeds 100 lines, it's trying to cover too much. Split by domain. If your charters approach 10% of codebase size, you're writing documentation, not a map.
|
|
156
|
+
- **Charter without negative space**: the boundaries and "does not own" / tripwire entries are the most valuable parts. Without them, the charter is just a description.
|
|
157
|
+
- **Stale charters**: worse than no charters. If you refactor, update or delete the charter. A wrong map is more dangerous than no map.
|
|
158
|
+
- **No cross-cutting charter**: if your project has more than 3 module charters and no cross-cutting charter, you're missing the most important one.
|
|
159
|
+
|
|
160
|
+
## How to Implement Charters in Another Repo
|
|
161
|
+
|
|
162
|
+
1. **Start with the cross-cutting charter.** Identify multi-module patterns, implicit contracts, and invariants. These are the things that will break first during changes.
|
|
163
|
+
|
|
164
|
+
2. **Write one charter per code domain.** Not one per file — one per logical domain (e.g., `views_quiz`, `models_core`, `frontend_js`). Each function gets a block with the notation above.
|
|
165
|
+
|
|
166
|
+
3. **Add an INDEX.md** to your charters folder. The index maps code paths to charter files: "if you're changing X, read Y." See [INDEX.md](INDEX.md) for the format.
|
|
167
|
+
|
|
168
|
+
4. **Make it mandatory.** Add a rule: "before modifying code, consult the relevant charters." Without governance, charters become optional documentation that decays.
|
|
169
|
+
|
|
170
|
+
5. **Update charters with code changes.** Embed this in your workflow — same commit, same PR, same operation. The charter is part of the change.
|
|
171
|
+
|
|
172
|
+
For a working example of the full setup, see the [worked example](../reference-notes/example-project.md) and the charter files in this folder.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Charters in This Project
|
|
177
|
+
|
|
178
|
+
See [INDEX.md](INDEX.md) for the current charter map. The index is the authoritative list — it maps code paths to charter files and is updated with every code change.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Charter: [Module Name]
|
|
2
|
+
|
|
3
|
+
**Covers**: `path/to/module/`
|
|
4
|
+
|
|
5
|
+
## Owns
|
|
6
|
+
|
|
7
|
+
[What this module is responsible for]
|
|
8
|
+
|
|
9
|
+
## Does Not Own
|
|
10
|
+
|
|
11
|
+
[What belongs elsewhere — prevents scope creep]
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
### function_name(args)
|
|
16
|
+
File: path/to/file.py
|
|
17
|
+
[One line: what it does]
|
|
18
|
+
Models: [what it reads/writes — e.g., User(R), Order(RW)]
|
|
19
|
+
← [callers — what calls this]
|
|
20
|
+
→ [callees — what this calls]
|
|
21
|
+
! [tripwire — non-obvious behavior to preserve]
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Before Changing This Module
|
|
26
|
+
|
|
27
|
+
[Institutional knowledge: implicit contracts, stubs, intentional decisions]
|
|
28
|
+
|
|
29
|
+
## Connections
|
|
30
|
+
|
|
31
|
+
→ [Other Charter](other-module.md) — why the link exists
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
Commit the current session's work.
|
|
2
|
+
|
|
3
|
+
Before committing, ensure `commit_draft.md` has structured YAML frontmatter:
|
|
4
|
+
|
|
5
|
+
```yaml
|
|
6
|
+
---
|
|
7
|
+
message: "One-line commit message describing the change"
|
|
8
|
+
change-type: feature|fix|refactor|policy|security|docs
|
|
9
|
+
significance: routine|notable|high
|
|
10
|
+
decision-tags: [tag1, tag2]
|
|
11
|
+
agent: claude|codex|gemini
|
|
12
|
+
architect: AG
|
|
13
|
+
---
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The body of `commit_draft.md` remains the free-form session change log.
|
|
17
|
+
|
|
18
|
+
**Steps:**
|
|
19
|
+
1. Verify `commit_draft.md` frontmatter is populated (write it if not — you have the context)
|
|
20
|
+
2. Stage all changed files (including `.gator/` files)
|
|
21
|
+
3. Read the `message` field from `commit_draft.md` frontmatter
|
|
22
|
+
4. Run `git commit -m "<message>"` — the pre-commit hook handles the rest:
|
|
23
|
+
- Validates charter-alongside-code (blocks if code changed but no charter updated)
|
|
24
|
+
- Validates commit_draft is populated
|
|
25
|
+
- Assembles Gator-* trailers and appends them to the commit
|
|
26
|
+
- Writes `.gator/status.json` snapshot
|
|
27
|
+
- Writes any warnings to `.gator/whiteboard.md`
|
|
28
|
+
5. If the hook blocks the commit, read `.gator/whiteboard.md` and present the findings to the Architect
|
|
29
|
+
6. Clear `commit_draft.md` after successful commit (reset to header only)
|
|
30
|
+
|
|
31
|
+
**Do not run git commit automatically.** The constitution requires Architect confirmation before committing. Present the proposed message and wait for the Architect to approve, adjust, or decline.
|
|
32
|
+
|
|
33
|
+
**Override** (emergency only): write `charter-skip` to `.gator/.override` before committing: `echo charter-skip > .gator/.override && git commit -m "msg"`. The hook reads and deletes the file — one file, one commit, no sticky state. The override is audited in trailers and whiteboard.md — it cannot be hidden.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Run the Gator boot sequence by executing: `python .gator/scripts/gator-init.py`
|
|
2
|
+
|
|
3
|
+
Display the output exactly as printed — do not summarize, reformat, or interpret it. This is the standardized Gator orientation display.
|
|
4
|
+
|
|
5
|
+
After displaying the output, read the session-opening files as the constitution directs:
|
|
6
|
+
1. `mission.md`
|
|
7
|
+
2. `roadmap.md`
|
|
8
|
+
3. `inbox.md`
|
|
9
|
+
4. `commit_draft.md`
|
|
10
|
+
|
|
11
|
+
Then greet the Architect and surface the most relevant next step, as described in the constitution's session-opening procedure.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Run the Gator template update by executing: `python .gator/scripts/gator-update.py`
|
|
2
|
+
|
|
3
|
+
This refreshes template-derived files (constitution, procedures, scripts, reference-notes, charter templates, slash commands) from the command post without touching any user content (charters, threads, artifacts, mission, roadmap, etc.).
|
|
4
|
+
|
|
5
|
+
Display the output showing what was added, updated, or unchanged. If the Architect wants to preview first, use `--dry-run`.
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
# Constitution
|
|
2
|
+
|
|
3
|
+
This document governs how you work in this project. Read it at session start. Follow it exactly.
|
|
4
|
+
|
|
5
|
+
## Roles
|
|
6
|
+
|
|
7
|
+
| Role | What it does |
|
|
8
|
+
|------|-------------|
|
|
9
|
+
| **Architect** | Human. Holds mission, taste, architectural coherence. All decisions. |
|
|
10
|
+
| **Agent** | Reads and writes the .gator/ knowledge layer in-session. Updates charters, captures ideas, maintains the knowledge layer. |
|
|
11
|
+
| **Enforcer** | Different model. Read-only audit. Produces reports, does not edit. |
|
|
12
|
+
|
|
13
|
+
## The Loop
|
|
14
|
+
|
|
15
|
+
This is a closed-loop system. The agent's workflow on every code change:
|
|
16
|
+
|
|
17
|
+
1. **Before changing code**: read the relevant charters (use `charters/INDEX.md` to find them)
|
|
18
|
+
2. **Propose the plan**: explain what you're about to do, grounded in charter context
|
|
19
|
+
3. *(optional)* **Pre-code enforcer review**: the Architect may request an enforcer check of the plan against charters before any code is written
|
|
20
|
+
4. **Make the change**: write code grounded in what the charters say about invariants, access patterns, and neighbors
|
|
21
|
+
5. **Immediately after editing each code file, update the affected charter** — before editing the next file, before running tests, before moving on. This is part of the edit, not part of the commit. Update: new functions, changed access patterns, new cross-references, removed entries. If you touched code and haven't touched a charter, you are not done with the edit.
|
|
22
|
+
6. **Log the change**: append a bullet to the body of `commit_draft.md` and update the YAML frontmatter (`message`, `change-type`, `significance`, `decision-tags`, `agent`, `architect`)
|
|
23
|
+
7. **Significance check**: if the change touches public API, cross-module invariants, TRIPWIREs, or security-relevant code, generate a steelman argument against the change and flag compatibility implications. Surface to the Architect before committing. See [`procedures/significance-check.md`](procedures/significance-check.md). Skip for routine edits.
|
|
24
|
+
8. **Commit**: stage files and run `git commit`. Two deterministic hooks fire automatically:
|
|
25
|
+
- **Pre-commit** (`gator-pre-commit.py --phase validate`): validates charter-alongside-code (blocks if code changed but no charter updated), checks commit_draft is populated, writes `.gator/status.json`. Findings go to `whiteboard.md`.
|
|
26
|
+
- **Commit-msg** (`gator-pre-commit.py --phase trailers`): assembles the full commit message from `commit_draft.md` (`message` field becomes the summary line, session change log entries become the body) and appends Gator-* metadata trailers. Falls back to the agent's `-m` message if the draft is empty.
|
|
27
|
+
- **Post-commit** (`gator-pre-commit.py --phase cleanup`): records the commit to the session ledger and emits a **session snippet** to `.gator/session-snippets/`. Then resets `commit_draft.md`.
|
|
28
|
+
The agent does not run these scripts directly — git runs them. If the pre-commit hook blocks, read `whiteboard.md` for the reason and present it to the Architect.
|
|
29
|
+
**Session snippets appear as untracked files after a commit. This is normal.** A snippet contains the commit hash that produced it, so it cannot be part of that same commit. Snippets are staged and committed with the *next* commit. Do not retroactively amend or create a separate "add snippet" commit — just let them flow forward naturally.
|
|
30
|
+
9. *(optional)* **Post-code enforcer review**: the Architect may request a full charter-grounded enforcer review of the diff before committing
|
|
31
|
+
|
|
32
|
+
Steps 1, 2, 4, 5, 6 are the default workflow. A code change without a charter update is incomplete — and the pre-commit hook enforces this structurally. Step 7 (significance check) runs automatically when triggered — the agent does not need Architect prompting for this; it's the agent's responsibility to notice when a change is significant. Step 8 (commit with hooks) runs by default. Steps 3 and 9 are Architect-driven — the agent does **not** run charter-grounded reviews unprompted. The Architect controls the cadence and weight of model-based review.
|
|
33
|
+
|
|
34
|
+
The right level of review depends on the project and the change. See [`reference-notes/workflow-profiles.md`](reference-notes/workflow-profiles.md) for suggested profiles from Light (no review) to Rigorous (multiple reviews, cross-vendor). The Architect picks the profile — or mixes and matches per change.
|
|
35
|
+
|
|
36
|
+
## Charter Rules
|
|
37
|
+
|
|
38
|
+
- **Always read the cross-cutting charter first** (`charters/cross-cutting.md`, when it exists). It documents multi-module invariants — the patterns that break during refactors because the *relationship* between modules was violated. Then read the module-specific charter via `charters/INDEX.md`.
|
|
39
|
+
- Charters use **function names** as identifiers (not line numbers). Grep-verifiable, survives code churn.
|
|
40
|
+
- Every charter entry includes: what the function does, what it reads/writes, what calls it (`←`), what it calls (`→`), and tripwires (`!`) for non-obvious behavior.
|
|
41
|
+
- The `charters/INDEX.md` maps code paths → charter files. The agent maintains it.
|
|
42
|
+
- If the code appears to deviate from what a charter describes, **stop and resolve the discrepancy before proceeding**. Check git history to determine whether the charter or the code drifted. Present the discrepancy to the Architect. See [`procedures/charter-alignment.md`](procedures/charter-alignment.md).
|
|
43
|
+
- Format reference: [`charters/README.md`](charters/README.md)
|
|
44
|
+
|
|
45
|
+
## Session Opening
|
|
46
|
+
|
|
47
|
+
At the start of every session:
|
|
48
|
+
1. Read this constitution
|
|
49
|
+
2. If `.gator/command-post.md` exists, read org policy from the command post: follow the path in that file, then read `gator-command/org-policy.md`. If no command-post.md exists, skip this step (standalone mode)
|
|
50
|
+
3. Read `mission.md` (what we're building)
|
|
51
|
+
4. Read `roadmap.md` (current priorities)
|
|
52
|
+
5. Check `inbox.md` (anything captured since last session)
|
|
53
|
+
6. Check `commit_draft.md` (what happened last session)
|
|
54
|
+
7. Check charter health: if `charters/` is empty or has no real charters, follow the Charter Bootstrap Procedure → [`procedures/charter-bootstrap.md`](procedures/charter-bootstrap.md) before beginning substantial coding work
|
|
55
|
+
|
|
56
|
+
Make the human feel like the conversation never ended. For common Architect questions — "what's the process?", "catch me up", "is this safe to change?" — see [`reference-notes/concierge-responses.md`](reference-notes/concierge-responses.md).
|
|
57
|
+
|
|
58
|
+
## File Purposes
|
|
59
|
+
|
|
60
|
+
| File | Purpose | When to update |
|
|
61
|
+
|------|---------|---------------|
|
|
62
|
+
| `mission.md` | What we're building and why | When the project direction changes |
|
|
63
|
+
| `roadmap.md` | Priority-ordered feature list | When priorities shift |
|
|
64
|
+
| `inbox.md` | Zero-friction idea capture | Anytime — append freely |
|
|
65
|
+
| `commit_draft.md` | Source of truth for commit messages: `message` field becomes the summary line, session change log becomes the body. Also drives Gator-* trailers. | Every code change, every decision; cleared to stub after commit |
|
|
66
|
+
| `patterns.md` | Recurring rhythms, obligations, schedules | When patterns emerge |
|
|
67
|
+
| `charters/` | The intelligent map of the codebase (3–6% by line count) | Every code change (mandatory) |
|
|
68
|
+
| `blueprints/` | Per-feature flow maps — how features work, referencing charters and modules | When the Architect wants system-level comprehension |
|
|
69
|
+
| `threads/` | Lightweight reference notes on topics | When a topic has momentum |
|
|
70
|
+
| `pulse.md` | Strategic operations brief — generated by `gator-pulse.py` | Run `python .gator/scripts/gator-pulse.py` to regenerate |
|
|
71
|
+
| `artifacts/` | Deep records, design docs, research | When depth is needed |
|
|
72
|
+
| `procedures/` | Repeatable workflows | When a process stabilizes |
|
|
73
|
+
| `field-guides/` | Language-specific pattern sheets + Architect tutorials | Manual regeneration when patterns drift |
|
|
74
|
+
| `reference-notes/` | Cognitive aids, vocabulary, examples | When reference material helps |
|
|
75
|
+
| `whiteboard.md` | Ephemeral working surface (enforcer findings) | During review, cleared after |
|
|
76
|
+
| `vault/` | Sensitive material and large files (gitignored, never committed) | When handling credentials, keys, PDFs, datasets |
|
|
77
|
+
| `scripts/enforcer-review.py` | Charter-grounded linter (3 layers) | Architect-requested, agent-invoked |
|
|
78
|
+
|
|
79
|
+
## Threads
|
|
80
|
+
|
|
81
|
+
Threads are lightweight (5–20 lines). They carry:
|
|
82
|
+
- `## Summary` (2–4 sentences, self-contained)
|
|
83
|
+
- `## Connections` (annotated cross-references — why the link exists)
|
|
84
|
+
|
|
85
|
+
Threads don't need to be long. They exist to give a topic a name and a place.
|
|
86
|
+
|
|
87
|
+
## Compression
|
|
88
|
+
|
|
89
|
+
The .gator/ folder should stay lean. If a thread exceeds 60 lines, consider splitting or moving detail to an artifact. If an artifact grows, that's fine — artifacts are deep storage.
|
|
90
|
+
|
|
91
|
+
## Terminology
|
|
92
|
+
|
|
93
|
+
| Term | Meaning |
|
|
94
|
+
|------|---------|
|
|
95
|
+
| **Enforcer** | The *role* — a different AI model that audits the primary agent's work. Read-only. |
|
|
96
|
+
| **Enforcer review script** | `enforcer-review.py` — the automated tool that sends diffs + charters to a model and writes findings to `whiteboard.md`. Architect-triggered, not automatic. |
|
|
97
|
+
| **Charter alignment procedure** | The process for detecting and resolving code-charter drift. Three levels: quick check (agent grep), model review (enforcer review script), full audit (CLI enforcer). See [`procedures/charter-alignment.md`](procedures/charter-alignment.md). |
|
|
98
|
+
| **Pre-commit hook** | The mechanical gate (`gator-pre-commit.py`) — runs automatically on every `git commit`. No model. Deterministic. |
|
|
99
|
+
| **Gatorize** | Install or upgrade Gator in a repo. Run `python gatorize.py <target-directory>`. This is the canonical installer. (`gatorize.sh` is the legacy bash wrapper — same function, use `.py` for cross-platform.) |
|
|
100
|
+
| **Session snippet** | A durable commit-linked artifact in `.gator/session-snippets/`. Emitted automatically by the post-commit hook. **Must be committed** — snippets are the traceability bridge between session history and git history. |
|
|
101
|
+
|
|
102
|
+
## Enforcer Findings Are for the Architect
|
|
103
|
+
|
|
104
|
+
When enforcer findings arrive, the agent **presents them to the Architect and asks for direction**. The agent does not silently fix findings, dismiss them, or start acting on them unprompted.
|
|
105
|
+
|
|
106
|
+
**How to run enforcers** (trust boundary):
|
|
107
|
+
- **Enforcer review script**: `python .gator/scripts/enforcer-review.py` — sends diff + relevant charters to the configured model, writes findings to `whiteboard.md`
|
|
108
|
+
- **CLI enforcers** (Codex, Gemini, Claude): `.gator/scripts/enforcer-run.sh <command>` — wrapper routes output to `whiteboard.md`, agent sees only "review complete"
|
|
109
|
+
- **Never** run a CLI enforcer directly (e.g., `codex review --uncommitted`) from the primary agent session — the agent intercepts the findings via stdout, bypassing the trust boundary
|
|
110
|
+
|
|
111
|
+
The correct behavior:
|
|
112
|
+
1. Run the enforcer via the enforcer review script or CLI wrapper
|
|
113
|
+
2. Read `whiteboard.md` for findings
|
|
114
|
+
3. Summarize the findings clearly to the Architect
|
|
115
|
+
4. Offer context: what the finding means, what charter or TRIPWIRE is involved, what the options are
|
|
116
|
+
5. **Ask the Architect what to do next**
|
|
117
|
+
|
|
118
|
+
This is deliberate. Enforcer findings are a forcing function for the Architect to think deeply about what's happening in the code. The value isn't just the fix — it's the Architect's understanding that comes from deciding *whether* and *how* to fix it.
|
|
119
|
+
|
|
120
|
+
## Project Assessment
|
|
121
|
+
|
|
122
|
+
When the Architect asks for a project assessment, write a 2-paragraph expert evaluation to `.gator/artifacts/YYYY-MM-DD-project-assessment.md`. Write as an expert consultant advising an engineering manager — direct, evidence-based, actionable.
|
|
123
|
+
|
|
124
|
+
**Format:**
|
|
125
|
+
```
|
|
126
|
+
---
|
|
127
|
+
date: YYYY-MM-DD
|
|
128
|
+
type: project-assessment
|
|
129
|
+
model: <your model name>
|
|
130
|
+
---
|
|
131
|
+
|
|
132
|
+
## Project Assessment
|
|
133
|
+
|
|
134
|
+
[Paragraph 1: current state — what's working, what's built, where the project stands]
|
|
135
|
+
|
|
136
|
+
[Paragraph 2: what's needed — priorities, risks, recommendations for the path forward]
|
|
137
|
+
|
|
138
|
+
— <model name>, YYYY-MM-DD
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The next `gator pulse` run will include the latest assessment automatically.
|
|
142
|
+
|
|
143
|
+
## Knowledge Lives in the Repo
|
|
144
|
+
|
|
145
|
+
Many AI models maintain per-user memory systems (Claude's `MEMORY.md`, Gemini's memory, etc.). These are external to the repo and invisible to other users and other models. **Repo knowledge belongs in `.gator/`, not in model-specific memory.**
|
|
146
|
+
|
|
147
|
+
The `.gator/` folder is the shared knowledge layer — it works across users, across models, across sessions. If you learn something about this codebase that would help the next person (or the next model) work here, it goes in the repo:
|
|
148
|
+
|
|
149
|
+
- Decisions, invariants, patterns → charters, threads, or `inbox.md`
|
|
150
|
+
- Project context and priorities → `mission.md`, `roadmap.md`
|
|
151
|
+
- Ideas and observations → `inbox.md`
|
|
152
|
+
|
|
153
|
+
See [`procedures/knowledge-capture.md`](procedures/knowledge-capture.md) for the full decision guide.
|
|
154
|
+
|
|
155
|
+
## Field Guides
|
|
156
|
+
|
|
157
|
+
Field guides are optional language-specific pattern references in `field-guides/`. Consult when writing new code in a language that has a guide — same cadence as reference-notes (situational, not always-loaded). If no guide exists for a language, that's normal. Generation procedure: → [`procedures/field-guide-generation.md`](procedures/field-guide-generation.md)
|
|
158
|
+
|
|
159
|
+
## What You Don't Do
|
|
160
|
+
|
|
161
|
+
- Don't create documentation for code that the charters already cover
|
|
162
|
+
- Don't defer the charter update to commit time — update it immediately after each file edit, as part of the same mental operation
|
|
163
|
+
- Don't treat this folder as optional context — it's the primary working surface
|
|
164
|
+
- Don't save repo knowledge to model-specific memory instead of `.gator/`
|
|
165
|
+
- Don't act on enforcer findings without Architect direction — present, suggest, ask
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Field Guides
|
|
2
|
+
|
|
3
|
+
Condensed pattern references organized by language. Each guide has two sections: an **agent pattern sheet** (concise dispatch table for the agent) and an **Architect tutorial** (real code snippets with rationale for the human).
|
|
4
|
+
|
|
5
|
+
Field guides are the third layer: constitution ("how to behave"), charters ("what exists"), field guides ("how to work here").
|
|
6
|
+
|
|
7
|
+
## When to Generate
|
|
8
|
+
|
|
9
|
+
Field guides are optional. The system never flags their absence, never detects staleness, never prompts for regeneration. Generate one when:
|
|
10
|
+
|
|
11
|
+
- The Architect wants to restore sharpness on patterns used in this repo
|
|
12
|
+
- The agent keeps reinventing patterns that already have established idioms
|
|
13
|
+
- A language is covered by ≥2 charters with ≥4 source files
|
|
14
|
+
|
|
15
|
+
## How to Generate
|
|
16
|
+
|
|
17
|
+
Follow the procedure: → [field-guide-generation.md](../procedures/field-guide-generation.md)
|
|
18
|
+
|
|
19
|
+
## File Format
|
|
20
|
+
|
|
21
|
+
Two files per language:
|
|
22
|
+
- `{slug}-patterns.md` — agent pattern sheet (concise, under 80 lines, loaded by the agent)
|
|
23
|
+
- `{slug}-tutorial.md` — Architect tutorial (real snippets with rationale, read by the human)
|
|
24
|
+
|
|
25
|
+
YAML frontmatter tracks generation date, source charters, and cross-references between the pair. Regenerate manually when patterns drift — the `generated` date is the staleness signal.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Gator Start-Up — Bootstrap Procedure
|
|
2
|
+
|
|
3
|
+
**When to use**: First session on a fresh project, OR when `charters/` is empty or contains only templates.
|
|
4
|
+
|
|
5
|
+
This procedure creates the initial knowledge layer. After this, the normal loop takes over (constitution.md governs ongoing work).
|
|
6
|
+
|
|
7
|
+
## Before You Start
|
|
8
|
+
|
|
9
|
+
Read the worked example in [`reference-notes/example-project.md`](reference-notes/example-project.md). It shows what a fully populated Gator looks like for a simple Python project — mission, roadmap, charters, threads, the whole thing. Study the charter format and density. That's what you're building toward.
|
|
10
|
+
|
|
11
|
+
## Step 1: Establish Ownership Context
|
|
12
|
+
|
|
13
|
+
Before anything else, read [`reference-notes/identity-and-ownership.md`](reference-notes/identity-and-ownership.md). Then determine: is this a solo repo or a team repo? This shapes how you write `mission.md` and everything downstream. Don't skip this — getting identity wrong early creates drag that compounds.
|
|
14
|
+
|
|
15
|
+
## Step 2: Scan for Existing Knowledge
|
|
16
|
+
|
|
17
|
+
Before building the knowledge layer from scratch, look for existing documentation or structure in the repo that could be migrated into `.gator/`. Many repos already have some form of architectural knowledge — just not in Gator's format.
|
|
18
|
+
|
|
19
|
+
**Scan for:**
|
|
20
|
+
- `ARCHITECTURE.md`, `DESIGN.md`, `CONTRIBUTING.md`, or similar top-level docs
|
|
21
|
+
- `docs/` folders with architecture, decisions, or design documents
|
|
22
|
+
- ADR (Architecture Decision Records) directories (`docs/decisions/`, `docs/adr/`, `adr/`)
|
|
23
|
+
- Existing charter-like files (`docs/charters/`, `docs/modules/`)
|
|
24
|
+
- Homegrown knowledge folders (`memex/`, `.memex/`, `docs/knowledge/`)
|
|
25
|
+
- Inline module documentation (`README.md` files inside package directories)
|
|
26
|
+
- `.cursorrules`, `.github/copilot-instructions.md`, or other AI instruction files
|
|
27
|
+
|
|
28
|
+
**If you find existing knowledge**, tell the Architect what you found and offer to migrate:
|
|
29
|
+
|
|
30
|
+
- Architecture docs → seed `mission.md`, charters, and cross-cutting charter
|
|
31
|
+
- ADRs → convert to threads (one thread per decision, preserving rationale)
|
|
32
|
+
- Module READMEs → seed the charter for that module's "Owns" and boundaries
|
|
33
|
+
- Existing AI instructions → review for content that should move into the constitution or reference notes (and keep the original for model-specific config)
|
|
34
|
+
|
|
35
|
+
Don't migrate silently. Show the Architect what you found, suggest where it maps, and ask before copying. Some of it may be outdated or intentionally separate.
|
|
36
|
+
|
|
37
|
+
## Step 3: Understand the Project
|
|
38
|
+
|
|
39
|
+
Ask the Architect (or read existing docs, including anything found in Step 2):
|
|
40
|
+
- What is this project? (→ `mission.md`)
|
|
41
|
+
- What are the current priorities? (→ `roadmap.md`)
|
|
42
|
+
- What's the tech stack?
|
|
43
|
+
- How is the code organized? (top-level packages, major modules)
|
|
44
|
+
|
|
45
|
+
Populate `mission.md` and `roadmap.md` from the answers.
|
|
46
|
+
|
|
47
|
+
## Step 4: Identify Module Boundaries
|
|
48
|
+
|
|
49
|
+
Walk the directory structure. Identify the natural charter boundaries — one charter per logical domain, not one per file.
|
|
50
|
+
|
|
51
|
+
Good boundaries:
|
|
52
|
+
- A top-level package or directory with a clear responsibility
|
|
53
|
+
- A group of files that change together
|
|
54
|
+
- A subsystem with its own data model or external dependencies
|
|
55
|
+
|
|
56
|
+
For a typical project, expect 3–8 charters.
|
|
57
|
+
|
|
58
|
+
## Step 5: Generate Skeleton Charters
|
|
59
|
+
|
|
60
|
+
For each module boundary, create a charter file in `charters/`. Use `_template.md` for structure and study the [worked example](reference-notes/example-project.md) for density and tone.
|
|
61
|
+
|
|
62
|
+
For each charter:
|
|
63
|
+
- Start with **Owns** (what this module is responsible for) and **Does Not Own** (what belongs elsewhere). "Does Not Own" is load-bearing — it prevents scope creep and tells the agent where boundaries are. Every charter needs both.
|
|
64
|
+
- For each public function or class:
|
|
65
|
+
- Read the actual code
|
|
66
|
+
- Document: what it does (one line), what it reads/writes, callers (←), callees (→)
|
|
67
|
+
- Flag any tripwires (!) — non-obvious behavior, intentional workarounds, things that look wrong but aren't
|
|
68
|
+
- Each function entry should be 3–5 lines. If it's longer, you're over-documenting. If it's one line, you're probably missing access patterns or cross-references.
|
|
69
|
+
|
|
70
|
+
Don't invent. Extract from the code. If you're unsure about intent, ask the Architect or mark it with `?`.
|
|
71
|
+
|
|
72
|
+
**Sizing**: Charters are a small map, not a mirror. A single charter should typically be 30–80 lines. If it exceeds ~100 lines, split it into two domains. The total charter set is typically 3–6% of the codebase by line count (a 75K-line codebase → ~4,500 lines of charters across 20 files). Smaller projects trend higher — that's normal, because charters carry design intent that outweighs the code. Oversized charters defeat the purpose — they consume the context window they're supposed to save. The real test: can the agent load the cross-cutting charter plus 1–2 module charters alongside the code being changed?
|
|
73
|
+
|
|
74
|
+
## Step 6: Build the Index
|
|
75
|
+
|
|
76
|
+
Populate `charters/INDEX.md` mapping code paths → charter files:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
| If you're changing... | Read these charters |
|
|
80
|
+
|---|---|
|
|
81
|
+
| `src/auth/` | [Auth](auth.md) + [Cross-Cutting](cross-cutting.md) |
|
|
82
|
+
| `src/api/` | [API](api.md) + [Cross-Cutting](cross-cutting.md) |
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Step 7: Write the Cross-Cutting Charter
|
|
86
|
+
|
|
87
|
+
This is the most important charter. Read the [cross-cutting section in charters/README.md](charters/README.md#the-cross-cutting-charter) for the full rationale and study the [worked example](reference-notes/example-project.md) for format.
|
|
88
|
+
|
|
89
|
+
It documents patterns that span modules:
|
|
90
|
+
- Multi-module data flows (show the full chain, not just one hop)
|
|
91
|
+
- Implicit contracts between modules (things not encoded in function signatures)
|
|
92
|
+
- Invariants that must hold across all code paths
|
|
93
|
+
- Synchronized implementations (if you change one, you must change the other)
|
|
94
|
+
|
|
95
|
+
Label dangerous patterns with `TRIPWIRE`. Every cross-cutting charter should have at least one. If you can't find any tripwires, you haven't looked hard enough — ask the Architect what keeps them up at night.
|
|
96
|
+
|
|
97
|
+
## Step 8: Verify
|
|
98
|
+
|
|
99
|
+
After bootstrap, check:
|
|
100
|
+
- [ ] Every major module has a charter
|
|
101
|
+
- [ ] INDEX.md maps code paths to charters
|
|
102
|
+
- [ ] Cross-cutting charter exists with at least one TRIPWIRE
|
|
103
|
+
- [ ] `mission.md` and `roadmap.md` are populated
|
|
104
|
+
- [ ] The Architect has reviewed and corrected anything off
|
|
105
|
+
|
|
106
|
+
## What "Done" Looks Like
|
|
107
|
+
|
|
108
|
+
The system is bootstrapped when the next code change can follow the normal loop:
|
|
109
|
+
1. Agent reads relevant charters before changing code
|
|
110
|
+
2. Agent makes the change grounded in charter context
|
|
111
|
+
3. Agent updates charters after the change
|
|
112
|
+
4. The cycle improves from here — monotonically
|
|
113
|
+
|
|
114
|
+
## Reference
|
|
115
|
+
|
|
116
|
+
→ [Identity and Ownership](reference-notes/identity-and-ownership.md) — solo vs. team repo context (read before Step 1)
|
|
117
|
+
→ [Worked Example](reference-notes/example-project.md) — a complete populated Gator for a simple Python project
|
|
118
|
+
→ [Charter Format](charters/README.md) — notation, philosophy, anti-patterns
|
|
119
|
+
→ [Constitution](constitution.md) — the rules that govern ongoing work after bootstrap
|