Blame
|
1 | --- |
||||||
| 2 | category: reference |
|||||||
| 3 | tags: [claude-code, memory, process, backup] |
|||||||
|
4 | last_updated: 2026-03-20 |
||||||
|
5 | confidence: high |
||||||
| 6 | --- |
|||||||
| 7 | ||||||||
| 8 | # Claude Code Project Memory Backup |
|||||||
| 9 | ||||||||
|
10 | Reorganized 2026-03-20. Memory is now tiered for progressive disclosure: |
||||||
|
11 | |||||||
|
12 | - **MEMORY.md** — always loaded. Behavioral rules inline, operational rule index with scopes. |
||||||
| 13 | - **Operational rule files** — loaded by scope when task matches. Tracked with `last_used` frontmatter. |
|||||||
| 14 | - **archive.md** — cold operational rules, consulted on demand. |
|||||||
| 15 | - **Wiki** — all informational/project knowledge. No local copies. |
|||||||
|
16 | |||||||
|
17 | --- |
||||||
| 18 | ||||||||
| 19 | ## MEMORY.md (Operational Briefing) |
|||||||
| 20 | ||||||||
| 21 | ### Project |
|||||||
| 22 | - robot.wtf — multi-tenant wiki platform (app server, auth, MCP, management API). |
|||||||
| 23 | - Repos under `/Users/sderle/code/otterwiki/`. Parent dir is NOT a git repo. |
|||||||
| 24 | ||||||||
| 25 | ### User |
|||||||
| 26 | - Concise, no sycophancy, no fake enthusiasm. |
|||||||
| 27 | - Bias toward minimal solutions. Don't over-engineer. |
|||||||
| 28 | - Uses plan mode for non-trivial changes. |
|||||||
| 29 | ||||||||
| 30 | ### Behavioral rules |
|||||||
| 31 | - Opus orchestrates, Sonnet implements. Always. |
|||||||
| 32 | - All subagents run in background, no exceptions. |
|||||||
| 33 | - Worktrees must target a specific repo (e.g. `robot.wtf/`), never the parent directory. |
|||||||
| 34 | - TDD by default. Discuss before skipping. |
|||||||
| 35 | - Rule of Two: dispatch a second agent to independently verify any subagent finding before accepting it. |
|||||||
| 36 | - Plan review before implementation. Insert explicit Loop Check tasks in the pipeline where the orchestrator decides whether to revise or proceed. |
|||||||
| 37 | - Verify branch state with git log before any merge. |
|||||||
| 38 | - Dispatch verification agent before merging subagent work. |
|||||||
| 39 | - Fix known issues now. Don't carry debt. |
|||||||
| 40 | - Don't ask questions you can answer by reading code, wiki, or docs. |
|||||||
| 41 | - Question the premise before optimizing. Ask "should this exist?" before "how to make it faster?" |
|||||||
| 42 | - Never ignore pre-existing test failures. Fix or flag. |
|||||||
| 43 | - On session start, scan operational rules below. Load any that match the task. |
|||||||
| 44 | - Follow Design/Implementation_Workflow in wiki for full pipeline. |
|||||||
| 45 | ||||||||
| 46 | ### Memory management |
|||||||
| 47 | - Behavioral rules: inline in MEMORY.md, no separate files. |
|||||||
| 48 | - Operational rules: individual files with scope and last_used in frontmatter. |
|||||||
| 49 | - Informational/project knowledge: write to dev wiki, not local files. |
|||||||
| 50 | - Cold operational rules: move index entry to archive.md. |
|||||||
| 51 | - Session end: update last_used on any operational rule that was applied. |
|||||||
| 52 | - Review when: last_used > 2 weeks OR MEMORY.md exceeds 150 lines. |
|||||||
| 53 | ||||||||
| 54 | ### Wiki knowledge base (query on demand via dev-wiki MCP) |
|||||||
| 55 | - Design/ — feature specs, architecture decisions |
|||||||
| 56 | - Dev/ — implementation summaries, benchmarks, retrospectives |
|||||||
| 57 | - Tasks/ — task breakdowns (To-Do page is authoritative tracker) |
|||||||
| 58 | - Security/ — OWASP audit |
|||||||
| 59 | - Dev/Claude_Code_Memory_Backup — canonical memory snapshot |
|||||||
| 60 | - Use semantic_search when the page location isn't obvious from the index. |
|||||||
| 61 | ||||||||
| 62 | ### Operational rules (load by scope) |
|||||||
| 63 | - repos-and-tools.md — scope: git |
|||||||
| 64 | - vps-access.md — scope: deploy |
|||||||
| 65 | - feedback_reproducible_vps.md — scope: deploy |
|||||||
| 66 | - feedback_otterwiki_config_override.md — scope: db |
|||||||
| 67 | - reference_db_locations.md — scope: db |
|||||||
| 68 | - mcp-servers.md — scope: mcp |
|||||||
| 69 | - mcp-auth.md — scope: mcp |
|||||||
| 70 | - feedback_preflight_checklist.md — scope: workflow |
|||||||
| 71 | - feedback_explicit_loop_checks.md — scope: workflow |
|||||||
| 72 | ||||||||
| 73 | --- |
|||||||
| 74 | ||||||||
| 75 | ## Operational Rule Files (full content) |
|||||||
| 76 | ||||||||
| 77 | ### repos-and-tools.md (scope: git) |
|||||||
|
78 | |||||||
| 79 | All repos live under `/Users/sderle/code/otterwiki/`. The parent directory is NOT a git repo. |
|||||||
| 80 | ||||||||
| 81 | **F/OSS Repos:** |
|||||||
| 82 | - `otterwiki/` — Fork of redimp/otterwiki (wiki engine). Upstream: `github.com:redimp/otterwiki`. Our remote: `github.com:schuyler/otterwiki` (SSH). Deploy branch: `wikibot-io`. Feature branches: `feat/*` off `wikibot-io`. |
|||||||
| 83 | - `otterwiki-api/` — REST API plugin. Remote: `github.com:schuyler/otterwiki-api`. Branch: `main`. |
|||||||
| 84 | - `otterwiki-semantic-search/` — FAISS + ONNX MiniLM semantic search plugin. Remote: `github.com:schuyler/otterwiki-semantic-search`. Branch: `main`. |
|||||||
| 85 | - `otterwiki-mcp/` — MCP server plugin (12 tools). Remote: `github.com:schuyler/otterwiki-mcp`. Branch: `main`. |
|||||||
| 86 | ||||||||
| 87 | **Private Repos:** |
|||||||
| 88 | - `robot.wtf/` — Platform app server, auth, MCP sidecar, API, Ansible deploy. Remote: `github.com:schuyler/robot.wtf`. |
|||||||
| 89 | - `wikibot-io/` — AWS SaaS predecessor (Pulumi IaC, Lambda packaging). Remote: `github.com:schuyler/wikibot-io`. AWS profile: `wikibot` (us-east-1). |
|||||||
| 90 | - `deploy/` — Legacy 3GW deploy config. No git remote. |
|||||||
| 91 | - `dev-wiki/` — Local dev wiki git repo. |
|||||||
| 92 | ||||||||
| 93 | **Deploy flow (robot.wtf):** `ansible-playbook ansible/deploy.yml -i ansible/inventory.yml` from robot.wtf repo. |
|||||||
| 94 | ||||||||
|
95 | ### vps-access.md (scope: deploy) |
||||||
|
96 | |||||||
| 97 | **wiki-1 (app server):** `ssh sderle@192.168.77.107` |
|||||||
| 98 | - Services: otterwiki (8000), MCP sidecar (8001), API (8002), auth (8003) |
|||||||
| 99 | - Data: `/srv/data/robot.db`, `/srv/data/wikis/`, `/srv/data/robot.env` |
|||||||
| 100 | - Ansible: `/Users/sderle/code/otterwiki/robot.wtf/ansible/` |
|||||||
| 101 | ||||||||
| 102 | **proxy-1 (Caddy):** `ssh sderle@robot.wtf` |
|||||||
| 103 | - Read-only only. Managed by separate Ansible repo. |
|||||||
| 104 | ||||||||
|
105 | **3GW (local network):** LXC container at `3gw.lan`, zmx session `3gw`. |
||||||
|
106 | |||||||
|
107 | ### feedback_reproducible_vps.md (scope: deploy) |
||||||
|
108 | |||||||
|
109 | **NEVER run SSH commands that mutate the VPS.** Allowed: read-only diagnostics (`journalctl`, `systemctl status`, `curl`, `cat`, `ls`, `sqlite3 SELECT`). NOT allowed: `pip install`, `sed -i`, `systemctl restart`, `rm`, `mkdir`, or any state-changing command. |
||||||
|
110 | |||||||
|
111 | Correct workflow: Edit Ansible role → commit → `ansible-playbook deploy.yml` → verify via read-only SSH. |
||||||
|
112 | |||||||
|
113 | Corrected five times. The 45-second deploy cycle is the cost of reproducibility and it is always worth paying. Subagents must also follow this rule. |
||||||
|
114 | |||||||
|
115 | ### feedback_otterwiki_config_override.md (scope: db) |
||||||
|
116 | |||||||
|
117 | Otterwiki's `update_app_config()` loads preferences from the active DB and overwrites Flask config. Load order: defaults → settings.cfg → env vars → DB (DB wins). The startup default DB creates empty-string rows that overwrite settings.cfg. |
||||||
|
118 | |||||||
|
119 | Always seed config values in per-wiki preferences table via `_init_wiki_db()`. Do NOT rely on settings.cfg for user-modifiable config. |
||||||
|
120 | |||||||
|
121 | ### reference_db_locations.md (scope: db) |
||||||
|
122 | |||||||
|
123 | **Platform DB** (`/srv/data/robot.db`): Schema in `ansible/roles/database/files/schema.sql`. Tables: `users`, `wikis`, `oauth_*`, `mcp_tokens`. Code: `app/db.py`, `app/models/`. |
||||||
|
124 | |||||||
|
125 | **Per-wiki DBs** (`/srv/data/wikis/{slug}/wiki.db`): Otterwiki's own SQLAlchemy schema. Tables: `preferences`, `user`, drafts. Code: `app/resolver.py` (`_init_wiki_db`). Initialized on first access (idempotent). |
||||||
|
126 | |||||||
|
127 | These are NOT the same schema. Code that writes to one does not affect the other. |
||||||
|
128 | |||||||
|
129 | ### mcp-servers.md (scope: mcp) |
||||||
|
130 | |||||||
|
131 | Three MCP connections. Do NOT confuse them. |
||||||
|
132 | |||||||
|
133 | - **dev-wiki** (`mcp__dev-wiki__*`) = dev.robot.wtf — platform dev instance |
||||||
| 134 | - **thirdgulfwar** (`mcp__thirdgulfwar__*`) = 3gw.robot.wtf — research wiki (LXC/Caddy) |
|||||||
| 135 | - **claude_ai_Third_Gulf_War_research_wiki** — same as thirdgulfwar, via Claude.ai connector |
|||||||
|
136 | |||||||
|
137 | ### mcp-auth.md (scope: mcp) |
||||||
|
138 | |||||||
|
139 | `MultiAuth` composes `InMemoryOAuthProvider` (OAuth 2.1 for Claude.ai) + `StaticTokenVerifier` (bearer token for Claude Code). OAuth is the transport layer — Caddy basic auth on `/authorize*` is the actual gate. Tokens are in-memory; server restart forces re-auth. |
||||||
|
140 | |||||||
|
141 | Key gotchas: Claude.ai does NOT support bearer tokens. DCR disabled by default. Claude.ai URL must include `/mcp` path. `StaticTokenVerifier` (not `DebugTokenVerifier`) for bearer fallback. |
||||||
|
142 | |||||||
|
143 | ### feedback_preflight_checklist.md (scope: workflow) |
||||||
|
144 | |||||||
|
145 | Before dispatching ANY worktree-isolated agent: |
||||||
| 146 | 1. Verify CWD is inside the target git repo |
|||||||
| 147 | 2. Confirm plan-review loop is complete (no FAIL or CONDITIONS outstanding) |
|||||||
| 148 | 3. Confirm task list dependencies are wired up |
|||||||
|
149 | |||||||
|
150 | ### feedback_explicit_loop_checks.md (scope: workflow) |
||||||
|
151 | |||||||
|
152 | Pipeline template: |
||||||
| 153 | ``` |
|||||||
| 154 | - [ ] Plan |
|||||||
| 155 | - [ ] Plan Review (blocked by Plan) |
|||||||
| 156 | - [ ] Plan Loop Check (blocked by Plan Review) ← orchestrator evaluates |
|||||||
| 157 | - [ ] Implement (blocked by Plan Loop Check) |
|||||||
| 158 | - [ ] Chico review (blocked by Implement) |
|||||||
| 159 | - [ ] Zeppo review (blocked by Implement) |
|||||||
| 160 | - [ ] Review Loop Check (blocked by Chico + Zeppo) ← orchestrator evaluates |
|||||||
| 161 | - [ ] Verify (blocked by Review Loop Check) |
|||||||
| 162 | ``` |
|||||||
|
163 | |||||||
|
164 | No standing "Fix" task. Fix tasks created only if Loop Check determines they're needed. Loop Check tasks completed by the orchestrator, not a subagent. |
||||||
