upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/AGENTS.md
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-11-04 10:25:53 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-11-04 10:25:53 +0000
commit52bad9954cdddf55ab749fd0c6387edbc766632f (patch)
treed9dd2078b70a627a71d1adb9555cee83faec5cd0 /AGENTS.md
parentdb460efdd4cf34d3b6ac8c19b1b8f89f22bc279f (diff)
docs: use Diátaxis structure
Diffstat (limited to 'AGENTS.md')
-rw-r--r--AGENTS.md394
1 files changed, 269 insertions, 125 deletions
diff --git a/AGENTS.md b/AGENTS.md
index 36a2616..7c2ac19 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -10,7 +10,7 @@
10 10
11### Overview 11### Overview
12 12
13We maintain a **clean, hierarchical documentation structure** to avoid documentation sprawl. All working documents have a defined lifecycle and location. 13We use the **[Diátaxis](https://diataxis.fr/) framework** for all documentation. This prevents documentation sprawl by organizing content into four clear categories based on purpose and audience.
14 14
15``` 15```
16ngit-grasp/ 16ngit-grasp/
@@ -18,36 +18,88 @@ ngit-grasp/
18├── AGENTS.md # This file - agent guidelines 18├── AGENTS.md # This file - agent guidelines
19├── CHANGELOG.md # User-facing changes (semver) 19├── CHANGELOG.md # User-facing changes (semver)
20 20
21├── docs/ # Permanent technical documentation 21├── work/ # Temporary session files (.gitignore'd)
22│ ├── README.md # Docs navigation guide 22│ ├── README.md # Only file committed to git
23│ ├── ARCHITECTURE.md # System architecture 23│ └── *.md # Session notes, status, plans (temporary)
24│ ├── TEST_STRATEGY.md # Testing approach
25│ ├── GIT_PROTOCOL.md # Git protocol reference
26│ ├── COMPARISON.md # vs other implementations
27│ ├── GETTING_STARTED.md # Setup guide
28│ └── DECISION_SUMMARY.md # Key architectural decisions
29 24
30├── docs/archive/ # Completed session/phase docs 25├── docs/ # All documentation (Diátaxis structure)
31│ ├── 2025-11-04-tag-migration.md 26│ ├── README.md # Navigation guide with quadrant diagram
32│ ├── 2025-11-04-flake-migration.md 27│ │
33│ ├── 2025-11-04-cleanup-visual-summary.txt # Visual summaries 28│ ├── tutorials/ # Learning-oriented (practical + learning)
34│ └── 2025-11-03-architecture-investigation.md 29│ │ ├── getting-started.md # First-time setup
35 30│ │ └── first-audit.md # Running your first audit
36├── docs/learnings/ # Extracted knowledge (permanent) 31│ │
37│ ├── nix-flakes.md # Flake gotchas and patterns 32│ ├── how-to/ # Task-oriented (practical + working)
38│ ├── nostr-sdk.md # nostr-sdk patterns and upgrades 33│ │ ├── deploy.md # Production deployment
39│ └── git-http-backend.md # Git protocol learnings 34│ │ ├── nix-flakes.md # Nix environment setup
35│ │ ├── test-compliance.md # Running compliance tests
36│ │ └── upgrade-nostr-sdk.md # SDK upgrade guide
37│ │
38│ ├── reference/ # Information-oriented (theoretical + working)
39│ │ ├── git-protocol.md # Git Smart HTTP protocol
40│ │ ├── grasp-protocol.md # GRASP specification
41│ │ ├── configuration.md # All config options
42│ │ ├── test-strategy.md # Testing reference
43│ │ └── api.md # Internal API docs
44│ │
45│ ├── explanation/ # Understanding-oriented (theoretical + learning)
46│ │ ├── architecture.md # System design overview
47│ │ ├── inline-authorization.md # Why inline auth?
48│ │ ├── comparison.md # vs ngit-relay
49│ │ └── decisions.md # Design decisions
50│ │
51│ ├── archive/ # Historical session notes
52│ │ └── YYYY-MM-DD-*.md # Completed work
53│ │
54│ └── learnings/ # DEPRECATED - migrated to Diátaxis
55│ └── README.md # Migration notice
40 56
41├── grasp-audit/ # Audit tool subproject 57├── grasp-audit/ # Audit tool subproject
42│ ├── README.md # Main audit docs 58│ ├── README.md # Main audit docs
43│ ├── QUICK_START.md # Getting started 59│ └── docs/ # Follows same Diátaxis structure
44│ └── docs/ 60│ ├── tutorials/
45│ └── archive/ # Audit-specific archives 61│ ├── how-to/
62│ ├── reference/
63│ └── explanation/
46 64
47└── .ai/ # AI assistant context (ignored in git) 65└── .ai/ # AI assistant context (ignored in git)
48 └── history/ # Conversation history 66 └── history/ # Conversation history
49``` 67```
50 68
69### Diátaxis Framework
70
71All documentation MUST fit into one of four categories:
72
73**📚 Tutorials** (`docs/tutorials/`)
74- **Purpose:** Learning-oriented, teach by doing
75- **Audience:** Newcomers, beginners
76- **Style:** Step-by-step lessons with guaranteed outcomes
77- **Examples:** Getting Started, First Audit
78- **Question:** "Can you teach me to...?"
79
80**🔧 How-To Guides** (`docs/how-to/`)
81- **Purpose:** Task-oriented, solve problems
82- **Audience:** Users with basic knowledge
83- **Style:** Practical recipes and solutions
84- **Examples:** Deploy, Configure, Troubleshoot
85- **Question:** "How do I...?"
86
87**📖 Reference** (`docs/reference/`)
88- **Purpose:** Information-oriented, technical facts
89- **Audience:** Users looking up specific information
90- **Style:** Dry, factual, comprehensive
91- **Examples:** API docs, Config options, Protocols
92- **Question:** "What is...?"
93
94**💡 Explanation** (`docs/explanation/`)
95- **Purpose:** Understanding-oriented, clarify concepts
96- **Audience:** Users wanting deeper understanding
97- **Style:** Discussion, context, alternatives
98- **Examples:** Architecture, Design Decisions, Comparisons
99- **Question:** "Why...?"
100
101**See:** [Diátaxis documentation](https://diataxis.fr/) for detailed guidance.
102
51### File Type Guidelines 103### File Type Guidelines
52 104
53**Markdown (.md):** 105**Markdown (.md):**
@@ -70,46 +122,62 @@ ngit-grasp/
70 122
71## 📋 Document Lifecycle 123## 📋 Document Lifecycle
72 124
73### 1. Working Documents (Root Level) 125### 1. Working Documents (work/ Directory)
74 126
75**Purpose:** Active development, session notes, status reports 127**Purpose:** Session-specific temporary files
76**Location:** Project root 128**Location:** `work/` directory (.gitignore'd)
77**Lifecycle:** Created → Updated → Archived 129**Lifecycle:** Created → Used → Archived or Deleted
78**Retention:** Archive after completion, delete if obsolete 130**Retention:** Archive valuable content, delete rest at session end
79 131
80**Examples:** 132**Examples:**
81- `TAG_MIGRATION_COMPLETE.md` → Archive when next phase starts 133- `work/session-notes.md` → Session notes and progress
82- `SESSION_2025_11_04_SUMMARY.md` → Archive at session end 134- `work/status.md` → Current status report
83- `NEXT_STEPS.md` → Update continuously, archive when complete 135- `work/migration-plan.md` → Planning document
84- `STATUS_VISUAL.txt` → Archive immediately after session 136- `work/visual-summary.txt` → ASCII art summaries
85 137
86**Rules:** 138**Rules:**
87- ✅ Use descriptive names with dates: `YYYY-MM-DD-description.md` 139- ✅ Create ALL session-specific docs in `work/`
88- ✅ Mark status clearly: `[WIP]`, `[COMPLETE]`, `[ARCHIVED]` 140- ✅ Use descriptive names (no date prefix needed)
89- ✅ Include date and context at top 141- ✅ Archive valuable content to `docs/archive/YYYY-MM-DD-name.md`
90- ✅ Use `.md` for docs, `.txt` only for ASCII art summaries 142- ✅ Delete obsolete files at session end
91- ❌ Don't let root accumulate more than 5-10 working docs 143- ✅ Keep `work/` clean (empty except README.md when not in session)
92- ❌ Don't create duplicates (merge or link instead) 144- ❌ Don't commit `work/` contents to git (except README.md)
93- ❌ Don't keep `.txt` files in root (archive immediately) 145- ❌ Don't reference `work/` docs from permanent documentation
146- ❌ Don't let `work/` accumulate files between sessions
147
148**Why work/ instead of root:**
149- Keeps root clean (only README.md, AGENTS.md, CHANGELOG.md)
150- Clear separation: permanent vs. temporary
151- Not committed to git (reduces noise)
152- Easy to clean up (just `rm -rf work/*`)
94 153
95### 2. Permanent Documentation (docs/) 154### 2. Permanent Documentation (docs/)
96 155
97**Purpose:** Long-term reference, architecture, guides 156**Purpose:** Long-term reference, architecture, guides
98**Location:** `docs/` 157**Location:** `docs/` (organized by Diátaxis category)
99**Lifecycle:** Created → Maintained → Updated 158**Lifecycle:** Created → Maintained → Updated
100**Retention:** Permanent (version controlled) 159**Retention:** Permanent (version controlled)
101 160
161**Structure:**
162- `docs/tutorials/` - Learning-oriented lessons
163- `docs/how-to/` - Task-oriented guides
164- `docs/reference/` - Information-oriented facts
165- `docs/explanation/` - Understanding-oriented discussion
166
102**Examples:** 167**Examples:**
103- `docs/ARCHITECTURE.md` - System design 168- `docs/tutorials/getting-started.md` - First-time setup
104- `docs/TEST_STRATEGY.md` - Testing approach 169- `docs/how-to/deploy.md` - Deployment guide
105- `docs/learnings/nix-flakes.md` - Extracted knowledge 170- `docs/reference/configuration.md` - Config options
171- `docs/explanation/architecture.md` - System design
106 172
107**Rules:** 173**Rules:**
174- ✅ Categorize by Diátaxis framework (tutorial/how-to/reference/explanation)
108- ✅ Keep updated as project evolves 175- ✅ Keep updated as project evolves
109- ✅ Use clear structure and headings 176- ✅ Use clear structure and headings
110- ✅ Link between related docs 177- ✅ Link between related docs
111- ❌ Don't duplicate information (use links) 178- ❌ Don't duplicate information (use links)
112- ❌ Don't include session-specific details 179- ❌ Don't include session-specific details
180- ❌ Don't put docs in wrong category (see Diátaxis guide)
113 181
114### 3. Archive (docs/archive/) 182### 3. Archive (docs/archive/)
115 183
@@ -129,24 +197,24 @@ ngit-grasp/
129- ❌ Don't modify after archiving 197- ❌ Don't modify after archiving
130- ❌ Don't reference in active documentation 198- ❌ Don't reference in active documentation
131 199
132### 4. Learnings (docs/learnings/) 200### 4. Learnings (DEPRECATED)
133 201
134**Purpose:** Reusable knowledge, gotchas, patterns 202**Status:** `docs/learnings/` is deprecated - content migrated to Diátaxis structure
135**Location:** `docs/learnings/` 203
136**Lifecycle:** Extracted → Maintained → Updated 204**Migration:**
137**Retention:** Permanent (living documents) 205- Gotchas and patterns → `docs/how-to/`
206- Technical details → `docs/reference/`
207- Understanding concepts → `docs/explanation/`
138 208
139**Examples:** 209**Examples:**
140- `docs/learnings/nix-flakes.md` - Flake patterns and gotchas 210- `learnings/nix-flakes.md` `how-to/nix-flakes.md`
141- `docs/learnings/nostr-sdk.md` - SDK upgrade notes 211- `learnings/nostr-sdk.md` `reference/nostr-sdk-upgrade.md`
142- `docs/learnings/git-http-backend.md` - Git protocol tips 212- `learnings/git-http-backend.md` `reference/git-protocol.md`
143 213
144**Rules:** 214**Rules:**
145- ✅ Extract from session docs before archiving 215- ❌ Don't create new files in `docs/learnings/`
146- ✅ Organize by topic, not by session 216- ✅ Migrate existing content to appropriate Diátaxis category
147- ✅ Include code examples 217- ✅ Add redirect notice in old location
148- ✅ Update as we learn more
149- ❌ Don't duplicate official docs (link instead)
150 218
151--- 219---
152 220
@@ -154,76 +222,107 @@ ngit-grasp/
154 222
155### When to Clean Up 223### When to Clean Up
156 224
157**Trigger:** Root directory has >10 markdown files OR any .txt files 225**Trigger:** End of session OR `work/` has >5 files
158**Frequency:** End of each major phase or weekly 226**Frequency:** End of each session (mandatory)
159**Responsibility:** AI agents should proactively suggest cleanup 227**Responsibility:** AI agents should proactively clean up before session end
160 228
161### Cleanup Steps 229### Cleanup Steps
162 230
1631. **Identify Completed Documents** 2311. **Review work/ Directory**
164 ```bash 232 ```bash
165 # Find old working docs 233 # List all working docs
166 ls -lt *.md | head -20 234 ls -la work/
167
168 # Check for .txt files (should always be archived)
169 ls -la *.txt
170 ``` 235 ```
171 236
1722. **Extract Learnings** 2372. **Extract to Diátaxis Categories**
173 - Review each completed doc 238 - Review each doc in `work/`
174 - Extract gotchas, patterns, solutions 239 - Extract valuable content to appropriate category:
175 - Add to appropriate `docs/learnings/*.md` 240 - Gotchas/solutions → `docs/how-to/`
241 - Technical facts → `docs/reference/`
242 - Concepts/design → `docs/explanation/`
243 - Lessons → `docs/tutorials/`
176 244
1773. **Archive Completed Work** 2453. **Archive Important Session Docs**
178 ```bash 246 ```bash
179 # Archive markdown with date prefix 247 # Archive valuable session docs with date prefix
180 mv TAG_MIGRATION_COMPLETE.md docs/archive/2025-11-04-tag-migration.md 248 mv work/migration-complete.md docs/archive/2025-11-04-migration-complete.md
249 mv work/visual-summary.txt docs/archive/2025-11-04-visual-summary.txt
250 ```
251
2524. **Delete Temporary Files**
253 ```bash
254 # Delete obsolete working docs
255 rm work/status.md
256 rm work/notes.md
181 257
182 # Archive .txt files immediately 258 # Or clean everything
183 mv STATUS_VISUAL.txt docs/archive/2025-11-04-status-visual.txt 259 rm -rf work/*
260 # (work/README.md is safe - in .gitignore exception)
184 ``` 261 ```
185 262
1864. **Delete Obsolete Documents** 2635. **Verify Clean State**
187 - Duplicates (keep most recent/complete) 264 ```bash
188 - Superseded documents 265 # Root should only have these:
189 - Pure status reports (no learnings) 266 ls *.md
267 # README.md
268 # AGENTS.md
269 # (CHANGELOG.md when created)
270
271 # work/ should be empty (except README.md)
272 ls work/
273 # README.md
274 ```
190 275
1915. **Update References** 2766. **Commit Changes**
192 - Update links in active docs 277 - Commit new permanent docs
193 - Update README.md if needed 278 - Commit archived docs
194 - Commit changes 279 - Note: work/ contents not committed (gitignored)
195 280
196### Example Cleanup 281### Example Cleanup
197 282
198```bash 283```bash
199# Before cleanup (36 files in root!) 284# Before cleanup (messy root!)
200ls *.md | wc -l
201# 36
202ls *.txt | wc -l
203# 5
204
205# After cleanup (3-5 files in root)
206ls *.md 285ls *.md
207# README.md 286# README.md
208# AGENTS.md 287# AGENTS.md
209# CURRENT_STATUS.md 288# CURRENT_STATUS.md
289# DIATAXIS_MIGRATION.md
290# SUMMARY.md
291# SESSION_NOTES.md
292# ... (many more)
293
294# After cleanup (clean root!)
295ls *.md
296# README.md
297# AGENTS.md
210 298
211ls *.txt 299# Working files in work/ during session
212# (none - all archived) 300ls work/
301# README.md
302# session-notes.md
303# status.md
304
305# After session cleanup
306ls work/
307# README.md
308# (all session files archived or deleted)
213 309
214# Archived 310# Archived
215ls docs/archive/ 311ls docs/archive/ | tail -5
216# 2025-11-04-tag-migration.md 312# 2025-11-04-diataxis-migration.md
217# 2025-11-04-flake-migration.md 313# 2025-11-04-diataxis-complete.md
218# 2025-11-04-cleanup-visual-summary.txt 314# 2025-11-04-diataxis-migration-visual.txt
219# 2025-11-03-architecture-investigation.md 315# 2025-11-04-session-summary.md
220# ... 316# ...
221 317
222# Learnings extracted 318# Permanent docs in Diátaxis structure
223ls docs/learnings/ 319ls docs/tutorials/
320# getting-started.md
321# first-audit.md
322
323ls docs/how-to/
224# nix-flakes.md 324# nix-flakes.md
225# nostr-sdk.md 325# deploy.md
226# git-http-backend.md
227``` 326```
228 327
229--- 328---
@@ -472,16 +571,28 @@ cargo build
472 - Use sections/subsections 571 - Use sections/subsections
473 572
4743. **Determine correct location** 5733. **Determine correct location**
475 - Working doc → Root 574 - Session-specific? → `work/` (temporary, gitignored)
476 - Permanent → docs/ 575 - Teaching beginners? → `docs/tutorials/`
477 - Learning → docs/learnings/ 576 - Solving a problem? → `docs/how-to/`
478 - Historical → docs/archive/ 577 - Technical reference? → `docs/reference/`
479 578 - Explaining concepts? → `docs/explanation/`
4804. **Use descriptive names with dates** 579 - Historical? → `docs/archive/`
481 - `YYYY-MM-DD-description.md` for working docs 580
482 - `topic-name.md` for permanent docs 5814. **Ask the Diátaxis questions:**
483 582 - "Can you teach me to...?" → Tutorial
4845. **Choose correct file format** 583 - "How do I...?" → How-To
584 - "What is...?" → Reference
585 - "Why...?" → Explanation
586
5875. **Use descriptive names**
588 - Working docs: `session-notes.md`, `status.md` (in `work/`)
589 - Archived docs: `YYYY-MM-DD-description.md` (in `docs/archive/`)
590 - Tutorials: `getting-started.md`, `first-audit.md`
591 - How-To: `deploy.md`, `nix-flakes.md`
592 - Reference: `configuration.md`, `api.md`
593 - Explanation: `architecture.md`, `decisions.md`
594
5956. **Choose correct file format**
485 - Use `.md` for all documentation (default) 596 - Use `.md` for all documentation (default)
486 - Use `.txt` ONLY for ASCII art visual summaries 597 - Use `.txt` ONLY for ASCII art visual summaries
487 - Archive `.txt` files immediately after session 598 - Archive `.txt` files immediately after session
@@ -502,29 +613,62 @@ cargo build
502 613
503### End of Session 614### End of Session
504 615
5051. **Suggest cleanup if needed** 6161. **Clean up work/ directory (MANDATORY)**
506 - Count root .md files 617 - Archive valuable session docs to `docs/archive/YYYY-MM-DD-*.md`
507 - Suggest archiving completed docs 618 - Delete temporary status reports
619 - Extract content to Diátaxis categories if needed
620 - Verify `work/` is empty (except README.md)
508 621
5092. **Create session summary** 6222. **Create session summary (if valuable)**
510 - What was accomplished 623 - Archive to `docs/archive/YYYY-MM-DD-session-summary.md`
511 - What's next 624 - Include: accomplishments, next steps, blockers
512 - Any blockers
513 625
5143. **Update permanent docs** 6263. **Update permanent docs**
515 - Sync README.md with reality 627 - Sync README.md with reality
516 - Update relevant docs/ files 628 - Update relevant docs/ files
629 - Commit changes
630
6314. **Verify clean state**
632 ```bash
633 ls *.md # Should only show README.md, AGENTS.md
634 ls work/ # Should only show README.md
635 ```
636
637### Cleanup Time (End of Session)
517 638
518### Cleanup Time 6391. **Review work/ directory**
640 ```bash
641 ls -la work/
642 ```
643
6442. **Extract content to appropriate Diátaxis category:**
645 - Gotchas/solutions → `docs/how-to/`
646 - Technical facts → `docs/reference/`
647 - Concepts/design → `docs/explanation/`
648 - Lessons → `docs/tutorials/`
649
6503. **Archive valuable session docs**
651 ```bash
652 mv work/important-notes.md docs/archive/2025-11-04-session-notes.md
653 mv work/visual-summary.txt docs/archive/2025-11-04-visual-summary.txt
654 ```
655
6564. **Delete temporary files**
657 ```bash
658 rm work/status.md
659 rm work/temp-notes.md
660 ```
661
6625. **Verify clean state**
663 ```bash
664 ls *.md # Only README.md, AGENTS.md
665 ls work/ # Only README.md
666 ```
519 667
5201. **Review all root .md and .txt files** 6686. **Commit permanent changes**
5212. **Extract learnings to docs/learnings/** 669 - Commit new/updated permanent docs
5223. **Archive completed work to docs/archive/** 670 - Commit archived docs
523 - `.md` files: Extract learnings first 671 - Note: work/ not committed (gitignored)
524 - `.txt` files: Archive immediately (no extraction needed)
5254. **Delete obsolete duplicates**
5265. **Update links in active docs**
5276. **Commit with clear message**
528 672
529--- 673---
530 674