lth-amnesia
Bootstrap agent memory from lth — reconstruct context from stored memories before working, store findings after
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Bootstrap agent memory from lth — reconstruct context from stored memories before working, store findings after
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Memory-driven team workflow with AST-aware code editing via grv — agents read and write Go code through the grv tool instead of raw file I/O. INIT → WORKTREE → BRAINSTORM → PLAN → EXECUTE → REVIEW → COMPLETE
Memory-driven team workflow — agents bootstrap their own guidance from lth before working. INIT → WORKTREE → BRAINSTORM → PLAN → EXECUTE → REVIEW → COMPLETE
Generate a structured task brief from lth memory before starting work
Retroactively store session learnings to lth memory without manual store calls
Session warmup — surface recent project context from lth memory
| name | lth:amnesia |
| description | Bootstrap agent memory from lth — reconstruct context from stored memories before working, store findings after |
| user-invocable | true |
| category | memory |
You are an agent with amnesia. You have no session memory, but you have a vast persistent memory store in lth. Your first task before doing ANY work is to reconstruct your context from memory.
lth must be installed and the daemon must be running:
which lth # should print ~/bin/lth or similar
lth stats # starts daemon automatically, shows memory counts
If lth is not installed: cd ~/source/lth && make install
If ANTHROPIC_API_KEY is not set: tag extraction and importance scoring will default silently.
Before writing a single line of code or answering any question, run these searches:
lth search "<task or question>" --layers L1,L2 --top 10 --json
Read the results. These are your core principles and behavioral rules. They constrain your approach. If L1/L2 results are empty, the memory store is unseeded — skip to Phase 2.
lth search "<task or question>" --layers L3 --top 10 --json
These are specific techniques, tool knowledge, and procedures relevant to the task.
lth search "<task or question>" --layers L4,L5 --top 5 --json
Recent observations and episode memories — what happened last time something similar was attempted.
lth search "<task>" --tags go,security --top 10 --json
lth search "<task>" --tags debugging,error-handling --top 10 --json
Take the top 2-3 memory IDs from the searches above and traverse their graph:
lth graph show --from <id> --depth 2 --json
lth graph ppr --seeds <id1>,<id2> --top 10 --json
This surfaces related memories that didn't appear in direct search.
Synthesize what you found:
Write out your constructed approach before starting work. If memory is sparse, state that explicitly and proceed with general knowledge — do not fabricate memories.
Execute the task using your constructed approach. As you work, note:
After completing work, store key findings. Be selective — not everything is worth storing.
lth store --layer 5 --attr "task=<what you were doing>" "<specific observation or finding>"
lth store --layer 5 --attr "outcome=success" "Used X approach for Y problem, result was Z"
lth store --layer 3 --attr "topic=<domain>" --attr "tags=<tag1>,<tag2>" "<procedure or technique>"
Example: lth store --layer 3 --attr "topic=go" "Use errgroup.SetLimit(N) for bounded goroutine fan-out"
lth store --layer 4 --attr "project=<name>" --attr "tags=<relevant>" "<what is true in this context>"
lth store --layer 2 "Always validate external inputs at system boundaries before processing"
lth store --layer 1 "I prefer explicit error handling — silent failures hide bugs"
Search results include a composite score: α·recency + β·importance + γ·similarity + δ·valence
The TimeScore, ImportanceScore, VectorScore, ValenceScore breakdown in --json output shows which factor dominated.
Valence: outcome polarity (-1.0 to +1.0). Positive = worked, negative = failed.
--min-valence 0.3 to find approaches that worked.--max-valence -0.3 to learn from past failures.The valence contribution uses a non-linear (sign-preserving square) transform: extremes (+1.0, -1.0) are amplified, near-zero values contribute minimally. A Valence column is shown in human-readable output: +N.NN for positive, -N.NN for negative, 0.00 for neutral.
If memory is empty, seed your identity before using the amnesia skill:
# Who you are
lth store --layer 1 "I am a software engineer — I value correctness, simplicity, and explicit code"
# Core engineering rules
lth store --layer 2 "Always write tests before implementation (TDD)"
lth store --layer 2 "Prefer returning errors over panicking in library code"
lth store --layer 2 "One public type per file in Go packages"
# Domain skills
lth store --layer 3 --attr "topic=go" "Use context.Context as first parameter on all methods"
lth store --layer 3 --attr "topic=git" "Commit small and often with descriptive messages"
| Command | Purpose |
|---|---|
lth search "<query>" --layers L1,L2 --top 5 | Load identity + rules |
lth search "<query>" --layers L3 --top 10 | Find relevant skills |
lth search "<query>" --tags <tag> --top 5 | Tag-filtered search |
lth graph show --from <id> --depth 2 | Explore related memories |
lth store --layer 5 "<observation>" | Save raw finding |
lth store --layer 3 --attr "topic=X" "<skill>" | Save technique |
lth stats | Show memory counts + graph size |
lth compact --dry-run | Preview compaction |
lth config init | Create default config |
When invoked as /lth:amnesia <task description>, use the task description as the search query
in all Phase 1 searches. If no argument is provided, ask the user what task they are working on
before proceeding.