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:
Diffstat (limited to 'AGENTS.md')
-rw-r--r--AGENTS.md829
1 files changed, 79 insertions, 750 deletions
diff --git a/AGENTS.md b/AGENTS.md
index 7c2ac19..e25299c 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -1,802 +1,131 @@
1# AI Agent Guidelines for ngit-grasp 1# AGENTS.md
2
3**Purpose:** Ensure AI agents (and humans) maintain consistent documentation practices and avoid common pitfalls.
4
5**Last Updated:** November 4, 2025
6
7---
8
9## πŸ“ Documentation Structure
10
11### Overview
12
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
15```
16ngit-grasp/
17β”œβ”€β”€ README.md # Project overview (keep updated)
18β”œβ”€β”€ AGENTS.md # This file - agent guidelines
19β”œβ”€β”€ CHANGELOG.md # User-facing changes (semver)
20β”‚
21β”œβ”€β”€ work/ # Temporary session files (.gitignore'd)
22β”‚ β”œβ”€β”€ README.md # Only file committed to git
23β”‚ └── *.md # Session notes, status, plans (temporary)
24β”‚
25β”œβ”€β”€ docs/ # All documentation (DiΓ‘taxis structure)
26β”‚ β”œβ”€β”€ README.md # Navigation guide with quadrant diagram
27β”‚ β”‚
28β”‚ β”œβ”€β”€ tutorials/ # Learning-oriented (practical + learning)
29β”‚ β”‚ β”œβ”€β”€ getting-started.md # First-time setup
30β”‚ β”‚ └── first-audit.md # Running your first audit
31β”‚ β”‚
32β”‚ β”œβ”€β”€ how-to/ # Task-oriented (practical + working)
33β”‚ β”‚ β”œβ”€β”€ deploy.md # Production deployment
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
56β”‚
57β”œβ”€β”€ grasp-audit/ # Audit tool subproject
58β”‚ β”œβ”€β”€ README.md # Main audit docs
59β”‚ └── docs/ # Follows same DiΓ‘taxis structure
60β”‚ β”œβ”€β”€ tutorials/
61β”‚ β”œβ”€β”€ how-to/
62β”‚ β”œβ”€β”€ reference/
63β”‚ └── explanation/
64β”‚
65└── .ai/ # AI assistant context (ignored in git)
66 └── history/ # Conversation history
67```
68 2
69### DiΓ‘taxis Framework 3This file provides guidance to agents when working with code in this repository.
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
103### File Type Guidelines
104
105**Markdown (.md):**
106- Primary format for all documentation
107- Easy to read in plain text and rendered
108- Supports code blocks, links, tables
109- Version control friendly
110
111**Text (.txt):**
112- Only for visual ASCII art summaries
113- Must be archived after session (never permanent)
114- Examples: status boxes, visual diagrams
115- Archive to `docs/archive/YYYY-MM-DD-name.txt`
116
117**Other formats:**
118- Avoid unless absolutely necessary
119- If needed, document in README.md why
120
121---
122
123## πŸ“‹ Document Lifecycle
124
125### 1. Working Documents (work/ Directory)
126
127**Purpose:** Session-specific temporary files
128**Location:** `work/` directory (.gitignore'd)
129**Lifecycle:** Created β†’ Used β†’ Archived or Deleted
130**Retention:** Archive valuable content, delete rest at session end
131
132**Examples:**
133- `work/session-notes.md` β†’ Session notes and progress
134- `work/status.md` β†’ Current status report
135- `work/migration-plan.md` β†’ Planning document
136- `work/visual-summary.txt` β†’ ASCII art summaries
137
138**Rules:**
139- βœ… Create ALL session-specific docs in `work/`
140- βœ… Use descriptive names (no date prefix needed)
141- βœ… Archive valuable content to `docs/archive/YYYY-MM-DD-name.md`
142- βœ… Delete obsolete files at session end
143- βœ… Keep `work/` clean (empty except README.md when not in session)
144- ❌ Don't commit `work/` contents to git (except README.md)
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/*`)
153
154### 2. Permanent Documentation (docs/)
155
156**Purpose:** Long-term reference, architecture, guides
157**Location:** `docs/` (organized by DiΓ‘taxis category)
158**Lifecycle:** Created β†’ Maintained β†’ Updated
159**Retention:** Permanent (version controlled)
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
167**Examples:**
168- `docs/tutorials/getting-started.md` - First-time setup
169- `docs/how-to/deploy.md` - Deployment guide
170- `docs/reference/configuration.md` - Config options
171- `docs/explanation/architecture.md` - System design
172
173**Rules:**
174- βœ… Categorize by DiΓ‘taxis framework (tutorial/how-to/reference/explanation)
175- βœ… Keep updated as project evolves
176- βœ… Use clear structure and headings
177- βœ… Link between related docs
178- ❌ Don't duplicate information (use links)
179- ❌ Don't include session-specific details
180- ❌ Don't put docs in wrong category (see DiÑtaxis guide)
181
182### 3. Archive (docs/archive/)
183
184**Purpose:** Historical record, completed phases
185**Location:** `docs/archive/`
186**Lifecycle:** Moved from root β†’ Archived
187**Retention:** Permanent (for reference)
188
189**Examples:**
190- `docs/archive/2025-11-04-tag-migration.md`
191- `docs/archive/2025-11-03-architecture-investigation.md`
192
193**Rules:**
194- βœ… Rename with date prefix when archiving
195- βœ… Add "ARCHIVED" marker at top
196- βœ… Extract learnings to docs/learnings/ first
197- ❌ Don't modify after archiving
198- ❌ Don't reference in active documentation
199
200### 4. Learnings (DEPRECATED)
201
202**Status:** `docs/learnings/` is deprecated - content migrated to DiΓ‘taxis structure
203
204**Migration:**
205- Gotchas and patterns β†’ `docs/how-to/`
206- Technical details β†’ `docs/reference/`
207- Understanding concepts β†’ `docs/explanation/`
208
209**Examples:**
210- `learnings/nix-flakes.md` β†’ `how-to/nix-flakes.md`
211- `learnings/nostr-sdk.md` β†’ `reference/nostr-sdk-upgrade.md`
212- `learnings/git-http-backend.md` β†’ `reference/git-protocol.md`
213
214**Rules:**
215- ❌ Don't create new files in `docs/learnings/`
216- βœ… Migrate existing content to appropriate DiΓ‘taxis category
217- βœ… Add redirect notice in old location
218
219---
220
221## πŸ”„ Cleanup Process
222
223### When to Clean Up
224
225**Trigger:** End of session OR `work/` has >5 files
226**Frequency:** End of each session (mandatory)
227**Responsibility:** AI agents should proactively clean up before session end
228
229### Cleanup Steps
230
2311. **Review work/ Directory**
232 ```bash
233 # List all working docs
234 ls -la work/
235 ```
236
2372. **Extract to DiΓ‘taxis Categories**
238 - Review each doc in `work/`
239 - Extract valuable content to appropriate category:
240 - Gotchas/solutions β†’ `docs/how-to/`
241 - Technical facts β†’ `docs/reference/`
242 - Concepts/design β†’ `docs/explanation/`
243 - Lessons β†’ `docs/tutorials/`
244
2453. **Archive Important Session Docs**
246 ```bash
247 # Archive valuable session docs with date prefix
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
257
258 # Or clean everything
259 rm -rf work/*
260 # (work/README.md is safe - in .gitignore exception)
261 ```
262
2635. **Verify Clean State**
264 ```bash
265 # Root should only have these:
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 ```
275
2766. **Commit Changes**
277 - Commit new permanent docs
278 - Commit archived docs
279 - Note: work/ contents not committed (gitignored)
280
281### Example Cleanup
282 4
283```bash 5## Project Structure
284# Before cleanup (messy root!)
285ls *.md
286# README.md
287# AGENTS.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
298 6
299# Working files in work/ during session 7**Workspace with Two Rust Projects:**
300ls work/ 8- Root: `ngit-grasp` (main GRASP relay implementation)
301# README.md 9- `grasp-audit/`: Separate subproject with own `Cargo.toml` and `flake.nix`
302# session-notes.md
303# status.md
304
305# After session cleanup
306ls work/
307# README.md
308# (all session files archived or deleted)
309
310# Archived
311ls docs/archive/ | tail -5
312# 2025-11-04-diataxis-migration.md
313# 2025-11-04-diataxis-complete.md
314# 2025-11-04-diataxis-migration-visual.txt
315# 2025-11-04-session-summary.md
316# ...
317
318# Permanent docs in DiΓ‘taxis structure
319ls docs/tutorials/
320# getting-started.md
321# first-audit.md
322
323ls docs/how-to/
324# nix-flakes.md
325# deploy.md
326```
327 10
328--- 11Cannot build grasp-audit from root - must `cd grasp-audit` first.
329 12
330## 🚨 Common Gotchas 13## Build & Test
331 14
332### Nix Flakes 15### Nix Flakes (Non-Standard)
333 16
334**Always use `nix develop`, not `nix-shell`** 17**CRITICAL:** Use `nix develop`, NOT `nix-shell` (we use flake.nix, not shell.nix)
335 18
336```bash 19```bash
337# βœ… Correct 20# βœ… Correct
338cd grasp-audit 21cd grasp-audit
339nix develop
340nix develop -c cargo build 22nix develop -c cargo build
23nix develop -c cargo test
341 24
342# ❌ Wrong 25# ❌ Wrong
343nix-shell 26nix-shell
344nix-shell --run "cargo build" 27nix-shell --run "cargo build"
345``` 28```
346 29
347**Why:** We use `flake.nix`, not `shell.nix`. See `docs/learnings/nix-flakes.md`. 30### Running Tests
348
349**Flake Commands:**
350```bash
351# Show flake outputs
352nix flake show
353
354# Update flake inputs
355nix flake update
356
357# Build package
358nix build
359
360# Run package
361nix run
362```
363
364### Git Subprojects
365 31
366**grasp-audit is a subproject with its own flake** 32**Integration tests require relay running:**
367 33
368```bash 34```bash
369# βœ… Correct - enter grasp-audit environment 35# Start ngit-relay first (tests run on port 18081)
370cd grasp-audit 36docker run --rm -p 18081:8081 -e NGIT_BIND_ADDRESS=0.0.0.0:8081 ghcr.io/decentralizedclimate/ngit-relay:latest
371nix develop
372cargo build
373
374# ❌ Wrong - can't build from root
375cd ngit-grasp
376cargo build # This won't find grasp-audit
377```
378
379**Why:** `grasp-audit/` has its own `Cargo.toml` and `flake.nix`.
380 37
381### nostr-sdk Versions 38# From grasp-audit directory
382 39nix develop -c cargo test --lib test_grasp01_nostr_relay_against_relay -- --ignored --nocapture
383**We use nostr-sdk 0.43.x (latest stable)**
384
385```toml
386# βœ… Correct
387[dependencies]
388nostr-sdk = "0.43"
389
390# ❌ Wrong
391nostr-sdk = "0.35" # Old version, breaking changes
392``` 40```
393 41
394**Why:** We upgraded from 0.35 to 0.43. See `docs/learnings/nostr-sdk.md` for migration notes. 42Tests marked `#[ignore]` need relay - unit tests don't.
395 43
396**Common Breaking Changes:** 44### Running Single Test
397- `EventBuilder::new()` signature changed
398- Tag API changed to `Tag::custom()`
399- Filter API changed
400- See archived upgrade docs for details
401
402### Testing Patterns
403
404**Integration tests require relay**
405 45
406```bash 46```bash
407# βœ… Correct - start relay first 47# From grasp-audit/
408docker run --rm -p 7000:7000 scsibug/nostr-rs-relay 48nix develop -c cargo test --lib specific_test_name -- --nocapture
409
410# Then run tests
411cd grasp-audit
412nix develop -c cargo test --ignored
413
414# ❌ Wrong - integration tests will fail
415cargo test --ignored # No relay running
416``` 49```
417 50
418**Test Organization:** 51## Code Patterns
419```rust
420// Unit tests (no relay needed)
421#[cfg(test)]
422mod tests {
423 #[test]
424 fn test_something() { }
425}
426
427// Integration tests (relay required)
428#[cfg(test)]
429mod tests {
430 #[test]
431 #[ignore] // Requires relay
432 fn test_against_relay() { }
433}
434```
435
436### Documentation Updates
437
438**Keep README.md synchronized**
439
440When you:
441- Complete a major feature β†’ Update README.md status
442- Change architecture β†’ Update docs/ARCHITECTURE.md
443- Add dependencies β†’ Update README.md tech stack
444- Change workflow β†’ Update docs/GETTING_STARTED.md
445 52
446**Don't:** 53### nostr-sdk 0.43 Breaking Changes (vs 0.35)
447- Create duplicate documentation
448- Leave stale status markers
449- Forget to update CHANGELOG.md for user-facing changes
450 54
451--- 55**Field access, not method calls:**
452 56
453## πŸ“„ File Format Guidelines 57```rust
454 58// ❌ WRONG (0.35 API)
455### When to Use .txt Files 59event.id()
456 60event.tags()
457**Use .txt ONLY for:** 61for tag in &event.tags { }
458- ASCII art visual summaries 62
459- Box diagrams with Unicode characters 63// βœ… CORRECT (0.43 API)
460- Terminal-style status displays 64event.id // Direct field access
461 65event.tags // Direct field access
462**Examples of appropriate .txt content:** 66event.tags.iter() // Iterator method
463```
464╔════════════════════════════════════════╗
465β•‘ STATUS: βœ… COMPLETE β•‘
466β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
467```
468
469**Rules:**
470- βœ… Create in root during session for visual impact
471- βœ… Archive immediately after session ends
472- βœ… Use descriptive names: `CLEANUP_VISUAL_SUMMARY.txt`
473- ❌ Never keep .txt files in root long-term
474- ❌ Don't use .txt for regular documentation
475- ❌ Don't duplicate information (use .md instead)
476
477**Lifecycle:**
478```
479Create .txt β†’ Use in session β†’ Archive immediately
480``` 67```
481 68
482### When to Use .md Files 69**Tag API changed:**
483 70```rust
484**Use .md for ALL documentation:** 71// ❌ WRONG (0.35)
485- Architecture docs 72Tag::Generic(TagKind::Custom("clone".into()), vec![...])
486- Session summaries
487- Status reports
488- Learnings
489- Planning documents
490- API documentation
491- User guides
492
493**Why markdown is preferred:**
494- Renders nicely on GitHub/GitLab
495- Supports code blocks with syntax highlighting
496- Easy to link between documents
497- Better for long-form content
498- Version control friendly
499
500---
501
502## πŸ“ Writing Guidelines
503
504### Markdown Style
505
506```markdown
507# Title (H1 - only one per file)
508
509**Date:** YYYY-MM-DD
510**Status:** [WIP|COMPLETE|ARCHIVED]
511
512## Section (H2)
513
514### Subsection (H3)
515
516**Bold** for emphasis, `code` for commands/code.
517
518- Bullet lists for items
519- Keep consistent style
520
5211. Numbered lists for sequences
5222. Use when order matters
523
524βœ… Use emoji for status (sparingly)
525❌ Don't overuse emoji
526 73
527\`\`\`bash 74// βœ… CORRECT (0.43)
528# Code blocks with language 75Tag::custom(TagKind::custom("clone"), vec![...])
529cargo build
530\`\`\`
531``` 76```
532 77
533### Status Markers 78**EventBuilder signature changed:**
534 79```rust
535- `[WIP]` - Work in progress 80// ❌ WRONG (0.35)
536- `[COMPLETE]` - Finished, may be archived 81EventBuilder::new(kind, content, &[tags])
537- `[ARCHIVED]` - Moved to archive, historical only
538- `βœ…` - Success/complete
539- `❌` - Failure/incorrect
540- `⏳` - In progress
541- `πŸ”œ` - Planned/next
542
543### Document Headers
544
545```markdown
546# Document Title
547
548**Purpose:** One-line purpose
549**Date:** YYYY-MM-DD
550**Status:** [WIP|COMPLETE|ARCHIVED]
551**Related:** Links to related docs
552
553---
554 82
555## Content starts here 83// βœ… CORRECT (0.43)
84EventBuilder::new(kind, content).tags(tags)
556``` 85```
557 86
558--- 87See `docs/archive/2025-11-04-nostr-sdk-upgrade.md` for full migration.
559
560## πŸ€– AI Agent Responsibilities
561
562### Before Creating New Documents
563
5641. **Check if document already exists**
565 ```bash
566 find . -name "*keyword*.md"
567 ```
568
5692. **Check if information can be added to existing doc**
570 - Prefer updating over creating
571 - Use sections/subsections
572
5733. **Determine correct location**
574 - Session-specific? β†’ `work/` (temporary, gitignored)
575 - Teaching beginners? β†’ `docs/tutorials/`
576 - Solving a problem? β†’ `docs/how-to/`
577 - Technical reference? β†’ `docs/reference/`
578 - Explaining concepts? β†’ `docs/explanation/`
579 - Historical? β†’ `docs/archive/`
580
5814. **Ask the DiΓ‘taxis questions:**
582 - "Can you teach me to...?" β†’ Tutorial
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**
596 - Use `.md` for all documentation (default)
597 - Use `.txt` ONLY for ASCII art visual summaries
598 - Archive `.txt` files immediately after session
599
600### During Development
601
6021. **Update status markers**
603 - Mark WIP β†’ COMPLETE when done
604 - Update README.md status section
605
6062. **Extract learnings as you go**
607 - Add gotchas to docs/learnings/
608 - Don't wait until cleanup
609
6103. **Keep documentation DRY**
611 - Link to existing docs
612 - Don't duplicate information
613
614### End of Session
615
6161. **Clean up work/ directory (MANDATORY)**
617 - Archive valuable session docs to `docs/archive/YYYY-MM-DD-*.md`
618 - Delete temporary status reports
619 - Extract content to DiΓ‘taxis categories if needed
620 - Verify `work/` is empty (except README.md)
621
6222. **Create session summary (if valuable)**
623 - Archive to `docs/archive/YYYY-MM-DD-session-summary.md`
624 - Include: accomplishments, next steps, blockers
625
6263. **Update permanent docs**
627 - Sync README.md with reality
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)
638
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 ```
667
6686. **Commit permanent changes**
669 - Commit new/updated permanent docs
670 - Commit archived docs
671 - Note: work/ not committed (gitignored)
672
673---
674
675## 🎯 Quality Checklist
676
677### For Every Document
678
679- [ ] Clear purpose stated at top
680- [ ] Date included
681- [ ] Status marker present
682- [ ] Proper heading hierarchy (H1 β†’ H2 β†’ H3)
683- [ ] Code blocks have language specified
684- [ ] Links are valid and relative
685- [ ] No duplicate information
686- [ ] Spell-checked and readable
687
688### For Working Documents
689
690- [ ] Descriptive filename with date
691- [ ] Will be archived or deleted when done
692- [ ] Not duplicating permanent docs
693- [ ] Learnings extracted to docs/learnings/
694
695### For Permanent Documents
696
697- [ ] In correct docs/ subdirectory
698- [ ] Linked from docs/README.md
699- [ ] Updated as project evolves
700- [ ] No session-specific details
701- [ ] Serves long-term purpose
702
703### For Archived Documents
704
705- [ ] Moved to docs/archive/
706- [ ] Renamed with date prefix
707- [ ] ARCHIVED marker at top (for .md files)
708- [ ] Learnings extracted first (for .md files)
709- [ ] Not referenced in active docs
710
711### For .txt Files
712 88
713- [ ] Contains only ASCII art/visual summaries 89## Documentation
714- [ ] Created in root for session use
715- [ ] Archived immediately after session
716- [ ] Not used for regular documentation
717- [ ] Descriptive filename with purpose clear
718
719---
720 90
721## πŸ“š Reference Documents 91**DiΓ‘taxis Framework Used:**
722 92- `docs/tutorials/` - Learning-oriented
723### Must Read 93- `docs/how-to/` - Task-oriented
724- **This file (AGENTS.md)** - Guidelines for documentation 94- `docs/reference/` - Information-oriented
725- **README.md** - Project overview 95- `docs/explanation/` - Understanding-oriented
726- **docs/README.md** - Documentation navigation
727
728### Key Technical Docs
729- **docs/ARCHITECTURE.md** - System design
730- **docs/TEST_STRATEGY.md** - Testing approach
731- **docs/GETTING_STARTED.md** - Setup guide
732 96
733### Learnings (Gotchas) 97**Session files go in `work/` (gitignored except README.md)**
734- **docs/learnings/nix-flakes.md** - Nix flake patterns 98- Archive valuable content to `docs/archive/YYYY-MM-DD-*.md` at session end
735- **docs/learnings/nostr-sdk.md** - nostr-sdk notes 99- Delete temporary files
736- **docs/learnings/git-http-backend.md** - Git protocol tips 100- Keep root clean (only README.md, AGENTS.md)
737 101
738--- 102## Critical Gotchas
739
740## πŸ”— Quick Links
741 103
742- [Project README](README.md) 1041. **Workspace compilation:** Can't `cargo build` from root for grasp-audit
743- [Documentation Index](docs/README.md) 1052. **Nix environment:** Must use `nix develop`, not `nix-shell`
744- [Architecture](docs/ARCHITECTURE.md) 1063. **nostr-sdk API:** Fields not methods in 0.43
745- [Learnings](docs/learnings/) 1074. **Test isolation:** Integration tests need relay, marked with `#[ignore]`
746- [Archive](docs/archive/) 1085. **Work directory:** All session docs go in `work/`, NOT root
1096. **Archive naming:** Use `YYYY-MM-DD-description.md` format
747 110
748--- 111## File Restrictions by Mode
749 112
750## πŸ’‘ Tips for Success 113Code mode can only edit files matching specific patterns (enforced by system):
114- Example: Architect mode restricted to `\.md$` files only
115- Attempting to edit restricted files causes FileRestrictionError
116- Check mode configuration if edit attempts fail unexpectedly
751 117
7521. **Less is more** - Prefer updating over creating 118## Quick Reference
7532. **Archive often** - Keep root clean
7543. **Extract learnings** - Make knowledge reusable
7554. **Link, don't duplicate** - DRY applies to docs too
7565. **Date everything** - Context is important
7576. **Use descriptive names** - Future you will thank you
7587. **Check before creating** - Document might already exist
7598. **Update as you go** - Don't wait for cleanup time
7609. **Use .md by default** - Only use .txt for ASCII art
76110. **Archive .txt immediately** - Don't let them linger
762 119
763--- 120```bash
764 121# Build grasp-audit
765## πŸš€ Next Steps 122cd grasp-audit && nix develop -c cargo build
766
767After reading this:
768
7691. **Review current documentation structure**
770 ```bash
771 ls -la *.md
772 ls -la docs/
773 ```
774
7752. **Identify cleanup candidates**
776 - Completed working docs
777 - Obsolete duplicates
778 - Session summaries
779
7803. **Extract learnings**
781 - Review completed docs
782 - Add to docs/learnings/
783
7844. **Archive and clean**
785 - Move to docs/archive/
786 - Delete obsolete files
787 - Update links
788
7895. **Commit changes**
790 ```bash
791 git add .
792 git commit -m "docs: cleanup and reorganization"
793 ```
794
795---
796 123
797**Remember:** Good documentation structure is like good code structure - it makes everything easier. 124# Run all tests (requires relay on 18081)
125cd grasp-audit && nix develop -c cargo test --ignored
798 126
799--- 127# Run single test
128cd grasp-audit && nix develop -c cargo test --lib test_name -- --nocapture
800 129
801*Last updated: November 4, 2025* 130# Check session files
802*Status: βœ… Active guidelines* 131ls work/ # Should only have README.md when clean \ No newline at end of file