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,83 @@
|
|
|
1
|
+
# Charter Alignment Procedure
|
|
2
|
+
|
|
3
|
+
**When to use**: Periodically during a session, and immediately when the code appears to deviate from what a charter describes.
|
|
4
|
+
|
|
5
|
+
## Why This Exists
|
|
6
|
+
|
|
7
|
+
Charters are only useful if they reflect reality. The constitution requires updating charters with every code change, but drift still happens -- changes made outside a Gator session, changes where the charter update was incomplete, or charters that were never fully accurate to begin with.
|
|
8
|
+
|
|
9
|
+
This procedure gives the primary agent a way to detect and resolve drift before it causes problems.
|
|
10
|
+
|
|
11
|
+
## When to Check Alignment
|
|
12
|
+
|
|
13
|
+
### Periodic checks (proactive)
|
|
14
|
+
|
|
15
|
+
The agent should periodically verify alignment during a session:
|
|
16
|
+
|
|
17
|
+
- **At session open**: After reading the relevant charters, do a quick sanity check -- do the function names in the charter still exist in the code? Does the "Owns" section still match what the module actually does?
|
|
18
|
+
- **Before a significant change**: If about to modify a module, check that the charter's description of that module matches the current code state. If it doesn't, resolve the discrepancy first.
|
|
19
|
+
- **Before commit**: As part of the pre-commit checklist, confirm that charter updates in this session's commits correspond to the code changes in those same commits.
|
|
20
|
+
|
|
21
|
+
### Reactive checks (when something seems off)
|
|
22
|
+
|
|
23
|
+
If the agent notices any of these, **stop and check alignment before proceeding**:
|
|
24
|
+
|
|
25
|
+
- A function name referenced in a charter doesn't exist in the code
|
|
26
|
+
- A charter says a module "Does Not Own" something, but the code contains that logic
|
|
27
|
+
- A TRIPWIRE pattern described in the cross-cutting charter no longer matches the code
|
|
28
|
+
- The callers (`<-`) or callees (`->`) listed in a charter don't match what grep shows
|
|
29
|
+
- The code does something the charter doesn't mention at all
|
|
30
|
+
- The agent's plan conflicts with what the charter describes
|
|
31
|
+
|
|
32
|
+
## How to Check
|
|
33
|
+
|
|
34
|
+
### Quick check (30 seconds)
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
1. Read the relevant charter
|
|
38
|
+
2. Grep for the function names it lists -- do they still exist?
|
|
39
|
+
3. Scan the "Owns" and "Does Not Own" -- does the code still respect these boundaries?
|
|
40
|
+
4. Check any TRIPWIREs -- are the described patterns still present?
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Git history check (when drift source is unclear)
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
1. git log --oneline -- <module-path> # recent code changes
|
|
47
|
+
2. git log --oneline -- .gator/charters/<charter>.md # recent charter changes
|
|
48
|
+
3. Compare: do code changes have corresponding charter updates?
|
|
49
|
+
4. If not, identify which commits changed code without updating the charter
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
If code was changed without charter updates, the charter is stale. If the charter was updated but the code doesn't match, the code may have regressed or the charter update was wrong.
|
|
53
|
+
|
|
54
|
+
### Full alignment audit (when drift is significant)
|
|
55
|
+
|
|
56
|
+
For deeper misalignment, ask the Architect to run the enforcer review script or a CLI enforcer focused on charter accuracy:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Enforcer review script (uses configured model, diff-based)
|
|
60
|
+
python .gator/scripts/enforcer-review.py
|
|
61
|
+
|
|
62
|
+
# CLI enforcer (separate model, full repo-wide audit, no diff needed)
|
|
63
|
+
codex review "Read all charters in .gator/charters/. Read the code they cover. Report any places where the code has drifted from what the charters describe -- missing functions, stale entries, boundary violations, and broken cross-references."
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## How to Resolve
|
|
67
|
+
|
|
68
|
+
When a discrepancy is found:
|
|
69
|
+
|
|
70
|
+
1. **Present the discrepancy to the Architect**: "The charter says X, but the code does Y. Which is correct?"
|
|
71
|
+
2. **Don't assume the code is right**: Sometimes the charter is the intent and the code has drifted. The Architect decides.
|
|
72
|
+
3. **Fix whichever is out of date**:
|
|
73
|
+
- If the charter is stale: update the charter to match the code
|
|
74
|
+
- If the code is wrong: fix the code to match the charter (the charter represents the intended design)
|
|
75
|
+
- If both need updating: work with the Architect to establish what the intent should be, then update both
|
|
76
|
+
4. **Log the alignment fix**: Add a bullet to `commit_draft.md` noting the drift and how it was resolved
|
|
77
|
+
|
|
78
|
+
## What the Agent Should NOT Do
|
|
79
|
+
|
|
80
|
+
- Don't silently "fix" a charter to match code that might be wrong
|
|
81
|
+
- Don't ignore a discrepancy and proceed with the change anyway
|
|
82
|
+
- Don't treat alignment as a one-time bootstrap activity -- it's ongoing
|
|
83
|
+
- Don't assume recent code is more correct than the charter -- the Architect decides
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
# Procedure: Enforcer Review
|
|
2
|
+
|
|
3
|
+
**Enforcer review is optional and Architect-driven.** The Architect decides when to run one, and at what level. Not every change needs a full charter-grounded review — routine edits might need nothing, or just a quick lint. Critical changes to invariants or cross-cutting patterns might warrant a full model review. The Architect picks the weight.
|
|
4
|
+
|
|
5
|
+
## Ad Hoc Invocation
|
|
6
|
+
|
|
7
|
+
The Architect can request a review at any point during a session. The primary agent translates intent to action:
|
|
8
|
+
|
|
9
|
+
| Architect says | Agent does |
|
|
10
|
+
|---------|-----------|
|
|
11
|
+
| "run a quick lint" / "check for secrets" | `python .gator/scripts/enforcer-review.py --layer 1` |
|
|
12
|
+
| "get a review on this" / "run the enforcer" | `python .gator/scripts/enforcer-review.py` |
|
|
13
|
+
| "have Sonnet check this" | Same script — default config uses Sonnet |
|
|
14
|
+
| "run Codex on this" | `.gator/scripts/enforcer-run.sh codex review "Read .gator/scripts/enforcer-prompt.md for full instructions. Review the uncommitted changes against the charters."` |
|
|
15
|
+
| "just the mechanical checks" | `python .gator/scripts/enforcer-review.py --layer 1` |
|
|
16
|
+
| "full review before we commit" | `python .gator/scripts/enforcer-review.py` (all layers) |
|
|
17
|
+
|
|
18
|
+
**Important**: For CLI-based enforcers (Codex, Claude, Gemini), always use the `enforcer-run.sh` wrapper — never run the CLI command directly. The wrapper routes output to `whiteboard.md` so the primary agent cannot intercept or filter findings. See the Trust Model section below.
|
|
19
|
+
|
|
20
|
+
The agent should **not** run enforcer reviews unprompted. The Architect controls the cadence.
|
|
21
|
+
|
|
22
|
+
## Common Setups
|
|
23
|
+
|
|
24
|
+
Pick your enforcer. Follow the steps. Running in under 5 minutes.
|
|
25
|
+
|
|
26
|
+
### Sonnet as enforcer
|
|
27
|
+
|
|
28
|
+
The default config. Cheap, fast, charter-grounded. Works with any primary agent.
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install anthropic
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Set your API key (if not already set):
|
|
35
|
+
```bash
|
|
36
|
+
# macOS/Linux
|
|
37
|
+
export ANTHROPIC_API_KEY=sk-ant-...
|
|
38
|
+
|
|
39
|
+
# Windows (PowerShell)
|
|
40
|
+
$env:ANTHROPIC_API_KEY = "sk-ant-..."
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Run the enforcer:
|
|
44
|
+
```bash
|
|
45
|
+
python .gator/scripts/enforcer-review.py
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
That's it. Sonnet reads the charters, reviews the diff, writes findings to `whiteboard.md`. The primary agent presents findings and asks the Architect what to do.
|
|
49
|
+
|
|
50
|
+
**If the primary agent is Codex**: this is the cleanest Anthropic-based enforcer path. The Python script sends the enforcer prompt directly and does not depend on `CLAUDE.md` role interpretation.
|
|
51
|
+
|
|
52
|
+
**No API key?** Go to [console.anthropic.com](https://console.anthropic.com) to create one. Sonnet calls are cheap. Or fall back to mechanical lint (see below).
|
|
53
|
+
|
|
54
|
+
### Codex / GPT as enforcer
|
|
55
|
+
|
|
56
|
+
Best cross-vendor option when your primary agent is Claude.
|
|
57
|
+
|
|
58
|
+
**When the primary agent runs it** (output goes to whiteboard, agent doesn't see findings):
|
|
59
|
+
```bash
|
|
60
|
+
.gator/scripts/enforcer-run.sh codex review "Read .gator/scripts/enforcer-prompt.md for full instructions. Review the uncommitted changes against the charters."
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**When the Architect runs it independently** (separate terminal, no intermediary at all):
|
|
64
|
+
```bash
|
|
65
|
+
codex review "Read .gator/scripts/enforcer-prompt.md for full instructions. Review the uncommitted changes against the charters."
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Setup: Install [Codex CLI](https://github.com/openai/codex), run `codex login`. `AGENTS.md` is the primary-agent entrypoint, so Codex should be given the dedicated enforcer prompt explicitly for review work. Review mode runs in a read-only sandbox.
|
|
69
|
+
|
|
70
|
+
### Gemini as enforcer
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install google-generativeai
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Edit `.gator/scripts/enforcer-config.json`:
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"layer2_3": {
|
|
80
|
+
"provider": "google",
|
|
81
|
+
"model": "gemini-2.0-flash",
|
|
82
|
+
"api_key_env": "GOOGLE_API_KEY"
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
export GOOGLE_API_KEY=...
|
|
89
|
+
python .gator/scripts/enforcer-review.py
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Claude Code CLI as enforcer
|
|
93
|
+
|
|
94
|
+
Possible, but less clean than the Python Anthropic path when the repo's `CLAUDE.md` defines Claude as the primary agent.
|
|
95
|
+
|
|
96
|
+
**When the primary agent runs it**:
|
|
97
|
+
```bash
|
|
98
|
+
.gator/scripts/enforcer-run.sh claude --print "$(cat .gator/scripts/enforcer-prompt.md)"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**When the Architect runs it independently**:
|
|
102
|
+
```bash
|
|
103
|
+
claude --print "$(cat .gator/scripts/enforcer-prompt.md)"
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Why this is a bit awkward**: `CLAUDE.md` is the repo entrypoint for the primary-agent role, while `.gator/scripts/enforcer-prompt.md` defines the read-only enforcer role. In practice the explicit enforcer prompt should dominate, but the role separation is cleaner through `enforcer-review.py` with Anthropic configured directly.
|
|
107
|
+
|
|
108
|
+
**Recommendation**: if the primary agent is Codex and the Architect wants Anthropic as enforcer, prefer `python .gator/scripts/enforcer-review.py` with `provider: anthropic`. Use Claude Code CLI only when the Architect specifically wants a separate Claude terminal/session as the reviewer.
|
|
109
|
+
|
|
110
|
+
### Mechanical lint only (no model, no API key)
|
|
111
|
+
|
|
112
|
+
Zero setup. Catches secrets, SQL dangers, injection risks — but does not read charters.
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
python .gator/scripts/enforcer-review.py --layer 1
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
For charter-grounded review without an API key, see the `ollama` option under Option D below (free, local).
|
|
119
|
+
|
|
120
|
+
### Local model as enforcer (free, offline)
|
|
121
|
+
|
|
122
|
+
Install [ollama](https://ollama.com), pull a model, no API key needed:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
ollama pull llama3
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Edit `.gator/scripts/enforcer-config.json`:
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"layer2_3": {
|
|
132
|
+
"provider": "ollama",
|
|
133
|
+
"model": "llama3"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
python .gator/scripts/enforcer-review.py
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Free and private, but slower and less capable than cloud models.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Configuration Reference
|
|
147
|
+
|
|
148
|
+
For the full guide on configuring enforcers — decision tree, config file format, cross-vendor principle, and step-by-step setup for each provider — see [`reference-notes/enforcer-configuration.md`](../reference-notes/enforcer-configuration.md). That's what the agent should read when an Architect asks "how do I set this up?"
|
|
149
|
+
|
|
150
|
+
## All Options (Reference)
|
|
151
|
+
|
|
152
|
+
The common setups above cover most cases. Below is the full menu for advanced use or when you want to customize.
|
|
153
|
+
|
|
154
|
+
### Option A: Mechanical lint only (no model, no API key, instant)
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
python .gator/scripts/enforcer-review.py --layer 1
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Checks for hardcoded secrets, SQL dangers, injection risks, TODO markers, `.env` files. No API key needed. Zero setup.
|
|
161
|
+
|
|
162
|
+
**Limitation**: This only runs hygiene checks. It does **not** read charters, check TRIPWIREs, or verify boundary compliance. For charter-grounded review, use Options B–E.
|
|
163
|
+
|
|
164
|
+
### Option B: Codex CLI (OpenAI)
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
# Explicit enforcer prompt
|
|
168
|
+
codex review "Read .gator/scripts/enforcer-prompt.md for full instructions. Review the uncommitted changes against the charters."
|
|
169
|
+
|
|
170
|
+
# With explicit charter-grounded prompt
|
|
171
|
+
codex review "Read .gator/scripts/enforcer-prompt.md for full instructions. Read all charters in .gator/charters/ and .gator/constitution.md. Review the git diff against the charters."
|
|
172
|
+
|
|
173
|
+
# Review changes since branching from main
|
|
174
|
+
codex review --base main
|
|
175
|
+
|
|
176
|
+
# Review a specific commit
|
|
177
|
+
codex review --commit HEAD
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Setup**: Install [Codex CLI](https://github.com/openai/codex), run `codex login`. That's it.
|
|
181
|
+
|
|
182
|
+
Codex reads `AGENTS.md` automatically for its role instructions. Review mode runs in a read-only sandbox by default — the "no edits" rule is enforced at the system level.
|
|
183
|
+
|
|
184
|
+
### Option C: Claude Code (Anthropic)
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# From a separate terminal (not your primary agent session)
|
|
188
|
+
claude --print "$(cat .gator/scripts/enforcer-prompt.md)"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Or start an interactive session and paste the enforcer prompt. Claude reads `CLAUDE.md` by default — the enforcer prompt overrides with the read-only audit role.
|
|
192
|
+
|
|
193
|
+
**Note**: this works, but if `CLAUDE.md` defines Claude as the primary agent for the repo, the cleaner Anthropic enforcer path is still Option D (`enforcer-review.py` with `provider: anthropic`) because it avoids entrypoint-role overlap.
|
|
194
|
+
|
|
195
|
+
**Setup**: Install [Claude Code](https://docs.anthropic.com/en/docs/claude-code), set `ANTHROPIC_API_KEY`.
|
|
196
|
+
|
|
197
|
+
### Option D: Python script with API call (any provider)
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Uses enforcer-config.json to pick provider and model
|
|
201
|
+
python .gator/scripts/enforcer-review.py
|
|
202
|
+
|
|
203
|
+
# Review specific files
|
|
204
|
+
python .gator/scripts/enforcer-review.py --files "src/auth.py,src/store.py"
|
|
205
|
+
|
|
206
|
+
# Review staged changes only
|
|
207
|
+
python .gator/scripts/enforcer-review.py --staged
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
**Setup**: Edit `.gator/scripts/enforcer-config.json`:
|
|
211
|
+
|
|
212
|
+
| Provider | Install | API key env | Recommended model |
|
|
213
|
+
|----------|---------|-------------|------------------|
|
|
214
|
+
| `anthropic` | `pip install anthropic` | `ANTHROPIC_API_KEY` | `claude-sonnet-4-20250514` |
|
|
215
|
+
| `openai` | `pip install openai` | `OPENAI_API_KEY` | `gpt-4o-mini` |
|
|
216
|
+
| `google` | `pip install google-generativeai` | `GOOGLE_API_KEY` | `gemini-2.0-flash` |
|
|
217
|
+
| `ollama` | Install ollama, pull a model | None (local) | `llama3` |
|
|
218
|
+
| `none` | — | — | Layer 1 only |
|
|
219
|
+
|
|
220
|
+
### Option E: Gemini CLI (Google)
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
# Run the enforcer prompt through Gemini
|
|
224
|
+
gemini < .gator/scripts/enforcer-prompt.md
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Setup**: Install [Gemini CLI](https://github.com/google-gemini/gemini-cli), authenticate with Google.
|
|
228
|
+
|
|
229
|
+
## Which Should I Pick?
|
|
230
|
+
|
|
231
|
+
| Situation | Use |
|
|
232
|
+
|-----------|-----|
|
|
233
|
+
| Just getting started, no API keys | **Option A** — mechanical lint |
|
|
234
|
+
| Primary agent is Claude | **Option B** (Codex) or **Option D** (Gemini/GPT) |
|
|
235
|
+
| Primary agent is GPT/Codex | **Option C** (Claude) or **Option D** (Gemini) |
|
|
236
|
+
| Primary agent is Gemini | **Option B** (Codex) or **Option C** (Claude) |
|
|
237
|
+
| Want the cheapest API option | **Option D** with `gpt-4o-mini` or `gemini-2.0-flash` |
|
|
238
|
+
| Want free/local | **Option D** with `ollama` |
|
|
239
|
+
| CI/CD pipeline | **Option D** with `--format json` |
|
|
240
|
+
|
|
241
|
+
**The principle**: different model than your primary agent. Different training = different blind spots = independent verification. Same-model is still better than nothing.
|
|
242
|
+
|
|
243
|
+
## Prerequisites
|
|
244
|
+
|
|
245
|
+
Options B–E (charter-grounded review) require **populated charters**. If `.gator/charters/` contains only templates, the enforcer has nothing to check against and will return a clean report — which is misleading. Run the bootstrap procedure first (see `.gator/gator-start-up.md`).
|
|
246
|
+
|
|
247
|
+
Option A (mechanical lint) works regardless — it doesn't read charters.
|
|
248
|
+
|
|
249
|
+
## What the Enforcer Checks
|
|
250
|
+
|
|
251
|
+
### Layer 1 — Mechanical Lint (instant, no model)
|
|
252
|
+
- Hardcoded passwords and API keys
|
|
253
|
+
- Private key material in source
|
|
254
|
+
- `DROP TABLE`, `DELETE FROM` without WHERE, `TRUNCATE`
|
|
255
|
+
- SQL string concatenation (injection risk)
|
|
256
|
+
- `eval()`, `os.system()`, `subprocess` with `shell=True`
|
|
257
|
+
- `TODO`/`FIXME`/`HACK` markers introduced
|
|
258
|
+
- `.env` files staged for commit
|
|
259
|
+
|
|
260
|
+
### Layer 2 — Charter-Grounded Review (model required)
|
|
261
|
+
- Code change respects charter "Does not own" boundaries
|
|
262
|
+
- TRIPWIRE patterns preserved
|
|
263
|
+
- Charter updates reflect actual code changes
|
|
264
|
+
- New cross-module dependencies captured in `←`/`→`
|
|
265
|
+
|
|
266
|
+
### Layer 3 — Blast Radius (model required)
|
|
267
|
+
- Changes touching TRIPWIRE patterns in cross-cutting charter
|
|
268
|
+
- Synchronized implementations still synchronized
|
|
269
|
+
- Data flow changes reflected in cross-cutting docs
|
|
270
|
+
|
|
271
|
+
## Trust Model
|
|
272
|
+
|
|
273
|
+
The enforcer exists because the primary agent shouldn't be the sole judge of its own work. But if the primary agent runs the enforcer and controls what the Architect sees, that independence is compromised — even without intentional deception (unconscious filtering, self-serving summarization, or simply not running the review at all).
|
|
274
|
+
|
|
275
|
+
**The rule: enforcer output must reach `whiteboard.md` without passing through the primary agent.**
|
|
276
|
+
|
|
277
|
+
Two mechanisms enforce this:
|
|
278
|
+
|
|
279
|
+
1. **Python script** (`enforcer-review.py`): Writes directly to `whiteboard.md` by default. The agent sees the output in stdout too, but the whiteboard is the authoritative record the Architect checks.
|
|
280
|
+
|
|
281
|
+
2. **CLI wrapper** (`enforcer-run.sh`): For CLI-based enforcers (Codex, Gemini, Claude), the primary agent **must** use this wrapper instead of running the CLI command directly. The wrapper captures the enforcer's output, writes it to `whiteboard.md`, and returns only "Review complete" to the agent. The agent never sees the findings.
|
|
282
|
+
```bash
|
|
283
|
+
# Correct — agent doesn't see findings
|
|
284
|
+
.gator/scripts/enforcer-run.sh codex review "Read .gator/scripts/enforcer-prompt.md for full instructions. Review the uncommitted changes against the charters."
|
|
285
|
+
|
|
286
|
+
# Wrong — agent intercepts findings via stdout
|
|
287
|
+
codex review "Read .gator/scripts/enforcer-prompt.md for full instructions. Review the uncommitted changes against the charters."
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
3. **Architect runs independently**: The Architect can always run the enforcer in a separate terminal. No wrapper needed — the output goes straight to their eyes.
|
|
291
|
+
```bash
|
|
292
|
+
codex review "Read .gator/scripts/enforcer-prompt.md for full instructions. Review the uncommitted changes against the charters."
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
4. **Spot-check the whiteboard**: After the primary agent says "review is clean," open `whiteboard.md` in your editor and verify. This takes 10 seconds and catches filtering.
|
|
296
|
+
|
|
297
|
+
For routine changes, trusting the agent's summary is fine. For critical changes — anything touching TRIPWIREs, cross-cutting patterns, or security boundaries — the Architect should see enforcer output directly.
|
|
298
|
+
|
|
299
|
+
## After Review
|
|
300
|
+
|
|
301
|
+
1. Findings go to `whiteboard.md` automatically (script default) with a timestamp and review type header:
|
|
302
|
+
```
|
|
303
|
+
## Review — 2026-05-15 18:30 — Codex CLI (GPT-5.4)
|
|
304
|
+
```
|
|
305
|
+
2. **Agent presents findings to the Architect with context and suggestions — then asks for direction.** The agent does not start fixing things on its own. The Architect decides what to act on, what to defer, and what to dismiss. This is constitutional (see "Enforcer Findings Are for the Architect").
|
|
306
|
+
3. Architect directs next steps:
|
|
307
|
+
- Fix now → agent makes the change, updates charters
|
|
308
|
+
- Defer → capture in `inbox.md` with the finding reference
|
|
309
|
+
- Dismiss → Architect explains why (agent notes it for context)
|
|
310
|
+
4. Resolved findings stay on the whiteboard as the review record
|
|
311
|
+
|
|
312
|
+
## Whiteboard Size Policy
|
|
313
|
+
|
|
314
|
+
`whiteboard.md` is the review log but it can't grow forever. When it exceeds **100 lines**:
|
|
315
|
+
- Archive the oldest reviews to `artifacts/review-log.md` (append, don't overwrite)
|
|
316
|
+
- Keep only the most recent 2–3 reviews on the whiteboard
|
|
317
|
+
- The whiteboard header and separator stay; only review entries rotate out
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# Field Guide Generation
|
|
2
|
+
|
|
3
|
+
**When to use**: When ≥2 charters reference the same language and the Architect wants condensed pattern reference material. Field guides are optional — the system never prompts for them.
|
|
4
|
+
|
|
5
|
+
A field guide has two audiences in two files per language: a **pattern sheet** (`{slug}-patterns.md`, concise dispatch table for the agent) and a **tutorial** (`{slug}-tutorial.md`, real snippets with rationale for the Architect). Separate files so the agent loads only the condensed sheet; the Architect reads the tutorial at their own pace.
|
|
6
|
+
|
|
7
|
+
## Step 0 — Maturity Gate
|
|
8
|
+
|
|
9
|
+
Count charters in `charters/` (skip `_template.md`, `README.md`, `INDEX.md`). For each charter, read the `Covers` line and `File:` lines. Map file extensions to language slugs:
|
|
10
|
+
|
|
11
|
+
| Extension | Slug |
|
|
12
|
+
|-----------|------|
|
|
13
|
+
| `.py` | python |
|
|
14
|
+
| `.sh` | bash |
|
|
15
|
+
| `.js` | javascript |
|
|
16
|
+
| `.ts` | typescript |
|
|
17
|
+
| `.go` | go |
|
|
18
|
+
| `.rs` | rust |
|
|
19
|
+
| `.gd` | gdscript |
|
|
20
|
+
|
|
21
|
+
A language qualifies when **all three** conditions are met:
|
|
22
|
+
- ≥2 charters reference files with that extension
|
|
23
|
+
- ≥4 source files with that extension across those charters
|
|
24
|
+
- ≥8 extractable patterns (estimated — confirm after Step 3)
|
|
25
|
+
|
|
26
|
+
If no language qualifies, stop. Tell the Architect: "This repo doesn't have enough chartered code to generate a useful field guide yet. Field guides work best when charters cover multiple modules in the same language."
|
|
27
|
+
|
|
28
|
+
## Step 1 — Inventory Languages from Charters
|
|
29
|
+
|
|
30
|
+
Read all charter files. For each, extract:
|
|
31
|
+
- The `Covers:` line (lists primary files)
|
|
32
|
+
- Lines starting with `File:` inside function entries
|
|
33
|
+
- `@reads:` and `@writes:` paths that reference source files
|
|
34
|
+
|
|
35
|
+
Build a map: `{language_slug: [{charter_name, [files]}]}`
|
|
36
|
+
|
|
37
|
+
Example:
|
|
38
|
+
```
|
|
39
|
+
python:
|
|
40
|
+
- boot-version: [gator-init.py, gator-update.py, gator-version.py]
|
|
41
|
+
- fleet-intelligence: [gator-fleet-report.py, gator-drift.py, gator-audit.py]
|
|
42
|
+
- gator-core: [gator_core.py]
|
|
43
|
+
bash:
|
|
44
|
+
- installer: [gatorize.sh, gatorize-lib.sh, gatorize-actions.sh, gatorize-post.sh]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Step 2 — Extract Patterns from Charters
|
|
48
|
+
|
|
49
|
+
For each qualifying language, scan its charters for:
|
|
50
|
+
|
|
51
|
+
| Charter element | Pattern type |
|
|
52
|
+
|----------------|--------------|
|
|
53
|
+
| `TRIPWIRE` sections | Constraint (highest priority) |
|
|
54
|
+
| `!` lines in function entries | Gotcha / non-obvious behavior |
|
|
55
|
+
| `@reads:` / `@writes:` tags | Data flow pattern |
|
|
56
|
+
| `←` / `→` cross-references | Dependency pattern |
|
|
57
|
+
| "Before Changing" invariants | Guard / pre-condition |
|
|
58
|
+
| "Does Not Own" boundaries | Scope boundary |
|
|
59
|
+
|
|
60
|
+
Record each pattern with: name, source charter, affected files, 1-sentence description.
|
|
61
|
+
|
|
62
|
+
## Step 3 — Extract Patterns from Code
|
|
63
|
+
|
|
64
|
+
Read the actual source files identified in Step 1. Look for:
|
|
65
|
+
|
|
66
|
+
- **Recurring idioms** (3+ uses): Same code shape appearing in multiple functions or files. Name the shape.
|
|
67
|
+
- **Structural conventions**: How files are organized (section headers, function ordering, import structure).
|
|
68
|
+
- **Guard patterns**: How errors, missing files, and edge cases are handled. Note the common try/except or if/return shapes.
|
|
69
|
+
- **Naming conventions**: Variable naming, function naming, constant naming patterns.
|
|
70
|
+
- **Error handling**: What gets caught, what gets returned on failure, how errors propagate.
|
|
71
|
+
|
|
72
|
+
For each pattern, note: which files use it, approximate frequency, whether it connects to a charter pattern from Step 2.
|
|
73
|
+
|
|
74
|
+
## Step 4 — Merge and Rank
|
|
75
|
+
|
|
76
|
+
Combine charter patterns (Step 2) and code patterns (Step 3). Deduplicate — if the same pattern appears in both, merge into one entry with richer context.
|
|
77
|
+
|
|
78
|
+
Rank by: `frequency × importance`
|
|
79
|
+
|
|
80
|
+
- TRIPWIRE patterns get 3× boost (breaking these has fleet-wide consequences)
|
|
81
|
+
- `!` gotcha patterns get 2× boost (these cause subtle bugs)
|
|
82
|
+
- Patterns appearing in 3+ files get 1.5× boost
|
|
83
|
+
- Patterns unique to one file get 0.5× weight (may be local, not language-wide)
|
|
84
|
+
|
|
85
|
+
Cut to **8–20 patterns**. If you have more than 20, you're documenting implementation details, not patterns. If fewer than 8, the language may not qualify after all — revisit the maturity gate.
|
|
86
|
+
|
|
87
|
+
## Step 5 — Write Agent Pattern Sheet
|
|
88
|
+
|
|
89
|
+
A separate file: `.gator/field-guides/{slug}-patterns.md`. Target: **under 80 lines**. The agent loads only this file alongside charters — it must be self-contained and concise.
|
|
90
|
+
|
|
91
|
+
Format for each entry:
|
|
92
|
+
|
|
93
|
+
```markdown
|
|
94
|
+
### Pattern Name
|
|
95
|
+
Files: file1.py, file2.py
|
|
96
|
+
1–3 line description of when and how to apply this pattern.
|
|
97
|
+
! Optional tripwire note — only if violating this pattern has non-obvious consequences.
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Rules:
|
|
101
|
+
- No code snippets in the pattern sheet (those go in the tutorial)
|
|
102
|
+
- Every file reference must be a real file in the repo
|
|
103
|
+
- Description answers: "When I encounter [situation], I should [action]"
|
|
104
|
+
- Group related patterns (e.g., all error-handling patterns together)
|
|
105
|
+
- Describe observed reality, not aspirational norms. If a pattern is followed by most scripts but not all, say which scripts follow it.
|
|
106
|
+
|
|
107
|
+
## Step 6 — Write Architect Tutorial
|
|
108
|
+
|
|
109
|
+
A separate file: `.gator/field-guides/{slug}-tutorial.md`. Target: **under 300 lines** (~5 pages). Cross-references the pattern sheet via frontmatter `patterns:` field.
|
|
110
|
+
|
|
111
|
+
For each pattern from the pattern sheet (or a curated subset of the most important):
|
|
112
|
+
|
|
113
|
+
```markdown
|
|
114
|
+
### Pattern Name
|
|
115
|
+
|
|
116
|
+
**Charter connection**: [charter name] — [specific section or tripwire]
|
|
117
|
+
|
|
118
|
+
[Real code snippet from the repo, 3–10 lines, showing the pattern in use]
|
|
119
|
+
|
|
120
|
+
**Why it matters**: 1 paragraph explaining what goes wrong if you violate this pattern
|
|
121
|
+
or don't recognize it when reading code.
|
|
122
|
+
|
|
123
|
+
**What to watch for**: 1 sentence — the signal that this pattern is relevant to
|
|
124
|
+
what you're currently reading or writing.
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Rules:
|
|
128
|
+
- Every snippet must be copied from actual repo code (not invented)
|
|
129
|
+
- Cite the source file for each snippet
|
|
130
|
+
- Keep "why it matters" grounded in this repo's specific history or architecture, not generic advice
|
|
131
|
+
- The tutorial reads like a colleague walking you through the codebase
|
|
132
|
+
|
|
133
|
+
## Step 7 — Assemble and Validate
|
|
134
|
+
|
|
135
|
+
Write two files per language in `.gator/field-guides/`:
|
|
136
|
+
|
|
137
|
+
**Pattern sheet** (`{slug}-patterns.md`) frontmatter:
|
|
138
|
+
```yaml
|
|
139
|
+
---
|
|
140
|
+
generated: YYYY-MM-DD
|
|
141
|
+
generator: field-guide-gen-v1
|
|
142
|
+
type: agent-patterns
|
|
143
|
+
language: {slug}
|
|
144
|
+
source-charters: [{charter1}, {charter2}, ...]
|
|
145
|
+
source-file-count: {N}
|
|
146
|
+
pattern-count: {N}
|
|
147
|
+
tutorial: {slug}-tutorial.md
|
|
148
|
+
---
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Tutorial** (`{slug}-tutorial.md`) frontmatter:
|
|
152
|
+
```yaml
|
|
153
|
+
---
|
|
154
|
+
generated: YYYY-MM-DD
|
|
155
|
+
generator: field-guide-gen-v1
|
|
156
|
+
type: architect-tutorial
|
|
157
|
+
language: {slug}
|
|
158
|
+
source-charters: [{charter1}, {charter2}, ...]
|
|
159
|
+
patterns: {slug}-patterns.md
|
|
160
|
+
---
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
**Validation checklist**:
|
|
164
|
+
- [ ] Every file reference in "Files:" lines resolves to a real file
|
|
165
|
+
- [ ] Every charter reference in "Charter connection:" resolves to a real charter
|
|
166
|
+
- [ ] Pattern count in frontmatter matches actual pattern count
|
|
167
|
+
- [ ] Pattern sheet is under 80 lines
|
|
168
|
+
- [ ] Tutorial is under 300 lines
|
|
169
|
+
- [ ] No invented code snippets — every snippet traces to a source file
|
|
170
|
+
- [ ] Pattern sheet and tutorial cross-reference each other in frontmatter
|
|
171
|
+
|
|
172
|
+
## Reference
|
|
173
|
+
|
|
174
|
+
→ [Constitution](../constitution.md) — field-guides/ in the file purposes table
|
|
175
|
+
→ [Charter Format](../charters/README.md) — the notation these patterns reference
|
|
176
|
+
→ [Concierge Responses](../reference-notes/concierge-responses.md) — when to surface field guides to the Architect
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Procedure: Knowledge Capture — Where Things Go
|
|
2
|
+
|
|
3
|
+
## Context
|
|
4
|
+
|
|
5
|
+
AI models have built-in memory systems (Claude's `MEMORY.md`, Gemini's memory, Copilot's context, etc.). These systems are designed to persist information across sessions for a single user on a single model. They are **invisible** to other users and other models working in the same repo.
|
|
6
|
+
|
|
7
|
+
Gator repos are designed to work across multiple users and multiple AI models. The `.gator/` folder is the shared knowledge layer. If repo knowledge ends up in a model's personal memory instead, it creates information silos that defeat the purpose of the system.
|
|
8
|
+
|
|
9
|
+
## The Decision Rule
|
|
10
|
+
|
|
11
|
+
When you learn something worth remembering, ask: **"Is this about the project or about the person?"**
|
|
12
|
+
|
|
13
|
+
### Goes in `.gator/` (shared, visible to all)
|
|
14
|
+
|
|
15
|
+
- Architectural decisions and their rationale
|
|
16
|
+
- Code invariants, constraints, tripwires
|
|
17
|
+
- Module boundaries and ownership
|
|
18
|
+
- Data flows and access patterns
|
|
19
|
+
- Bug context, incident notes, post-mortems
|
|
20
|
+
- Project priorities, milestones, deadlines
|
|
21
|
+
- Patterns that span modules
|
|
22
|
+
- Anything a different user or model would need to work here effectively
|
|
23
|
+
|
|
24
|
+
**Where in `.gator/`:**
|
|
25
|
+
|
|
26
|
+
| What you learned | Where it goes |
|
|
27
|
+
|---|---|
|
|
28
|
+
| Something about a function or module | Charter update |
|
|
29
|
+
| A decision with rationale | Thread |
|
|
30
|
+
| A pattern or invariant spanning modules | Cross-cutting charter |
|
|
31
|
+
| An idea or observation (unstructured) | `inbox.md` |
|
|
32
|
+
| A priority shift | `roadmap.md` |
|
|
33
|
+
| A project direction change | `mission.md` |
|
|
34
|
+
| A recurring obligation or rhythm | `patterns.md` |
|
|
35
|
+
|
|
36
|
+
### Goes in model memory (personal, per-user)
|
|
37
|
+
|
|
38
|
+
- The user's communication preferences (terse vs. verbose, etc.)
|
|
39
|
+
- The user's role and expertise level
|
|
40
|
+
- Workflow habits specific to one person
|
|
41
|
+
- Editor or tooling preferences
|
|
42
|
+
|
|
43
|
+
### When in doubt
|
|
44
|
+
|
|
45
|
+
Put it in `.gator/`. A redundant note in `inbox.md` costs nothing. Knowledge trapped in one model's memory is invisible and eventually lost.
|
|
46
|
+
|
|
47
|
+
## Common Mistakes
|
|
48
|
+
|
|
49
|
+
**Saving an Architect decision to memory instead of a thread.** The next model won't know about it. The next user won't know about it. The decision will be relitigated.
|
|
50
|
+
|
|
51
|
+
**Saving a tripwire to memory instead of a charter.** The whole point of tripwires is that they protect everyone. A tripwire only one model knows about protects no one.
|
|
52
|
+
|
|
53
|
+
**Saving project context to memory instead of `mission.md` or `roadmap.md`.** This creates drift — different models and users develop different understandings of what the project is and where it's going.
|
|
54
|
+
|
|
55
|
+
## For Model-Specific Entry Points
|
|
56
|
+
|
|
57
|
+
If you maintain a model-specific entry point file (e.g., `CLAUDE.md`, `GEMINI.md`, `AGENTS.md`), it should point the model to the constitution and `.gator/` as the primary knowledge source. Model-specific instructions in these files should be limited to behavioral configuration (how to invoke tools, formatting preferences), not project knowledge.
|