skills/th0th-memory/SKILL.md
Mandatory rules for using th0th semantic search, compression, memory, and symbol graph tools. Prioritize th0th tools over native tools (Glob, Grep, Read) to explore and understand code. Triggers on tasks involving code search, context compression, storing decisions, symbol navigation, or retrieving project knowledge.
npx skillsauth add s1lv4/th0th th0th-memoryInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Mandatory rules for using th0th tools. Prioritize semantic search, compression, memory, and symbol graph tools over native tools (Glob, Grep, Read) to explore and understand code.
Reference these guidelines when:
| Priority | Tool | Use |
|----------|------|-----|
| 1 | th0th_index | Index project before searching (returns jobId for background jobs) |
| 2 | th0th_index_status | Poll background indexing job status by jobId |
| 3 | th0th_search | Semantic + keyword search with filters |
| 4 | th0th_optimized_context | Search + compress in one call (max token efficiency) |
| 5 | th0th_search_definitions | Find symbol definitions (functions, classes, types) |
| 6 | th0th_get_references | Find all usages of a symbol across the project |
| 7 | th0th_go_to_definition | Jump to a symbol's definition with context |
| 8 | th0th_list_projects | List all indexed projects and their status |
| 9 | th0th_reset_project | Delete all indexed data for a project (vectors, symbols, memories) |
| 10 | th0th_remember | Store important information in persistent memory |
| 11 | th0th_recall | Retrieve memories from previous sessions |
| 12 | th0th_compress | Reduce context size (70-98%) |
| 13 | th0th_analytics | Usage patterns and metrics |
| 14 | th0th_read_file | Read file/line-range with symbol metadata (prefer over Read when you have lineStart/lineEnd) |
| 15 | th0th_project_map | One-shot project overview: PageRank backbone, symbol counts, language distribution |
| 16 | th0th_synapse_session | Create/resume Synapse cognitive session (task alignment, agent affinity, working memory) |
| 17 | th0th_synapse_prime | Seed Synapse buffer with recalled memories before searching |
| 18 | th0th_synapse_access | Record file access for affinity scoring (call after reading/editing a file) |
| 19 | th0th_symbol_snippet | Get raw code snippet by file + line range |
| 20 | th0th_memory_list | Browse memories by type/importance without a query (audit mode) |
| 21 | th0th_reindex | Force full reindex (when autoReindex/50-file limit is insufficient) |
| 22 | Glob/Grep/Read | Only when th0th doesn't find what you need |
Index a project directory for semantic search. Returns immediately with a jobId; polling is optional (use th0th_index_status).
th0th_index({
projectPath: "/home/user/my-project",
projectId: "my-project",
forceReindex: false,
warmCache: true,
warmupQueries: ["authentication", "database schema"]
})
Poll a background indexing job by the jobId returned from th0th_index.
th0th_index_status({
jobId: "job_abc123"
})
CRITICAL — polling discipline (mandatory):
Never call th0th_index_status in a tight loop. Choose one strategy:
Strategy A — single Bash sleep loop (preferred for normal tasks):
# TH0TH_API_URL is set by the MCP server environment; falls back to localhost:3333
TH0TH_API_URL="${TH0TH_API_URL:-http://localhost:3333}"
for i in $(seq 1 40); do
result=$(curl -s "$TH0TH_API_URL/api/v1/project/index/status/JOB_ID")
status=$(echo "$result" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['data']['status'])")
progress=$(echo "$result" | python3 -c "import sys,json; d=json.load(sys.stdin); print(d['data'].get('progress',0))")
echo "[$i] status=$status progress=$progress%"
[ "$status" = "completed" ] || [ "$status" = "failed" ] && break
sleep 15
done
Strategy B — ScheduleWakeup (only inside /loop mode):
ScheduleWakeup({ delaySeconds: 30, reason: "waiting for th0th indexing job JOB_ID", prompt: "<<autonomous-loop-dynamic>>" })
Then on the next wake-up call th0th_index_status once and repeat or finish.
Never do this:
# BAD: calling th0th_index_status repeatedly in successive turns without sleeping
th0th_index_status(...) # turn 1
th0th_index_status(...) # turn 2 — WRONG, wastes context and burns turns
th0th_index_status(...) # turn 3 — WRONG
Semantic + keyword search with RRF (Reciprocal Rank Fusion).
th0th_search({
query: "JWT authentication middleware",
projectId: "my-project",
maxResults: 10,
minScore: 0.3,
responseMode: "summary", // "summary" saves ~70% tokens vs "full"
autoReindex: false, // set true to auto-refresh stale index
explainScores: false, // set true for vector/keyword/RRF breakdown
include: ["src/**/*.ts"],
exclude: ["**/*.test.*"]
})
responseMode:
"summary" (default) — returns preview only; saves ~70% tokens."full" — includes full file content; use when you need to read code."enriched" — full content + fileImports + parentSymbol in every result; best for deep dives without extra tool calls. Use chunkIndex/totalChunks to navigate adjacent chunks.Search + compress in one call. Maximum token efficiency.
Always pass sessionId to activate the session file cache. On repeated calls within the same conversation, unchanged file chunks are replaced with a compact reference token (~8 tokens) instead of full content, saving 50-70% of input tokens in long sessions.
th0th_optimized_context({
query: "how does authentication work?",
projectId: "my-project",
sessionId: "<stable identifier for the current conversation>",
maxTokens: 4000,
maxResults: 5
})
The response includes metadata.tokensSavedBySessionCache and data.sessionCacheHits so you can observe the savings.
Find symbol definitions (functions, classes, variables, types, interfaces, exports) in an indexed project.
th0th_search_definitions({
projectId: "my-project",
query: "UserService", // substring match, case-insensitive
kind: "class,function", // comma-separated: function,class,variable,type,interface,export
file: "src/services/user.ts",
exportedOnly: false,
limit: 20
})
Find all usages of a symbol across the project. Returns file paths, line numbers, reference kinds (call, import, type_ref, extend, implement), and code context.
th0th_get_references({
projectId: "my-project",
symbolName: "UserService",
fqn: "services/user.ts#UserService", // disambiguates when name is shared
limit: 50
})
Jump to a symbol's definition. Disambiguates using calling file context.
th0th_go_to_definition({
projectId: "my-project",
symbolName: "getPrismaClient",
fromFile: "src/controllers/search-controller.ts"
})
List all indexed projects and their current status.
th0th_list_projects({
status: "all" // pending | indexing | indexed | error | all
})
Delete all indexed data for a project. Each scope is independent and defaults to true.
th0th_reset_project({
projectId: "my-project",
clearVectors: true, // remove vector embeddings (semantic search index)
clearSymbols: true, // remove symbol graph (definitions, references, imports, centrality)
clearMemories: true // remove stored memories for this project
})
When to use:
th0th_reset_project → th0th_index)Response includes: vectorsDeleted, symbolsCleared, memoriesDeleted counts.
Store important information in persistent memory.
th0th_remember({
content: "Using PostgreSQL for user data",
type: "decision",
importance: 0.8,
tags: ["database", "architecture"],
projectId: "my-project",
sessionId: "session-123",
agentId: "architect",
format: "toon" // "json" or "toon"
})
Search stored memories from previous sessions.
th0th_recall({
query: "database decisions",
types: ["decision"],
limit: 10,
minImportance: 0.3,
projectId: "my-project",
agentId: "architect",
includePersistent: true,
format: "toon"
})
Compress context (keeps structure, removes details).
th0th_compress({
content: "...large code...",
strategy: "code_structure",
targetRatio: 0.7,
language: "typescript"
})
Usage patterns, cache performance, metrics.
th0th_analytics({
type: "summary", // summary | project | query | cache | recent
projectId: "my-project",
limit: 10
})
| Strategy | Use Case | Reduction |
|----------|----------|-----------|
| code_structure | Source code | 70-90% |
| conversation_summary | Chat history | 80-95% |
| semantic_dedup | Repetitive content | 50-70% |
| hierarchical | Structured docs | 60-80% |
| Type | Use |
|------|-----|
| critical | Critical user-defined facts |
| conversation | Important conversation points |
| code | Code patterns discovered |
| decision | Architecture decisions |
| pattern | Recurring patterns |
Need to find code?
→ th0th_search with responseMode:"summary" (first)
→ Glob/Grep/Read (fallback only)
Need to navigate symbols?
→ th0th_go_to_definition (jump to definition)
→ th0th_get_references (find all usages)
→ th0th_search_definitions (list matching symbols)
Need to understand architecture?
→ th0th_recall (check memories first)
→ th0th_search (explore code)
→ th0th_search_definitions (enumerate public API)
Found important pattern/decision?
→ th0th_remember (store for future sessions)
Context too large?
→ th0th_compress (reduce tokens)
Maximum efficiency needed?
→ th0th_optimized_context (search + compress + session cache)
Need to check indexed projects?
→ th0th_list_projects (see status, file counts, last indexed)
Indexing taking long?
→ th0th_index_status (poll jobId from th0th_index)
→ WAIT between polls: use a single Bash sleep loop (15s intervals) or ScheduleWakeup in /loop mode
→ NEVER call th0th_index_status in successive turns without sleeping first
Need a clean slate before reindexing?
→ th0th_reset_project (wipe vectors + symbols + memories)
→ th0th_index (reindex from scratch)
curl -fsSL https://raw.githubusercontent.com/S1LV4/th0th/main/install.sh | bash
Supports three modes (select interactively or override with TH0TH_MODE):
| Mode | TH0TH_MODE | Requirements | Best for |
|------|--------------|--------------|---------|
| Docker | docker | Docker | Production, quick start |
| Docker build | build | Docker + Git | Custom builds, local changes |
| From source | source | Git + Bun | Development, contributors |
Non-interactive example:
TH0TH_MODE=docker TH0TH_API_PORT=4000 TH0TH_NO_START=1 \
curl -fsSL https://raw.githubusercontent.com/S1LV4/th0th/main/install.sh | bash
Config file: ~/.config/th0th/config.json (auto-created on first run)
| Provider | Default Model | Dimensions | Cost |
|----------|---------------|------------|------|
| Ollama (default) | bge-m3 | 1024 | Free |
| Ollama alt | qwen3-embedding | 4096 | Free |
| Mistral | mistral-embed | — | $$ |
| OpenAI | text-embedding-3-small | — | $$ |
npx @th0th-ai/mcp-client --config-show # print current config
npx @th0th-ai/mcp-client --config-path # show config file path
npx @th0th-ai/mcp-client --config-init # init with Ollama defaults
npx @th0th-ai/mcp-client --config-init --mistral YOUR_KEY # init with Mistral
npx @th0th-ai/mcp-client --config-init --openai YOUR_KEY # init with OpenAI
npx @th0th-ai/mcp-client --config-init --ollama-model bge-m3 # switch Ollama model
npx @th0th-ai/mcp-client --config-set embedding.dimensions 1024 # set specific value
bun run diagnose # checks Ollama, database, embeddings, migration status
bge-m3 / 1024d by default.prisma-adapter-bun-sqlite. Run bun run diagnose after setup.host.docker.internal:host-gateway in docker-compose.yml.DATABASE_URL=postgresql://... and POSTGRES_PASSWORD. Migrations run automatically on docker compose up.development
Use the th0th Synapse cognitive modulation layer to get focused, low-noise retrieval during multi-step coding tasks. Open a session, prime the buffer with known-relevant memories, pass synapseSessionId on every search, and prefetch when opening a file. Triggers on tasks involving repeated searches in the same context (debugging, code review, refactor, onboarding) where retrieval quality matters more than one-shot speed.
tools
Use when work should span one or more detached tasks but still behave like one job with a single owner context. TaskFlow is the durable flow substrate under authoring layers like Lobster, ACPX, plugins, or plain code. Keep conditional logic in the caller; use TaskFlow for flow identity, child-task linkage, waiting state, revision-checked mutations, and user-facing emergence.
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------
tools
# Lobster Lobster executes multi-step workflows with approval checkpoints. Use it when: - User wants a repeatable automation (triage, monitor, sync) - Actions need human approval before executing (send, post, delete) - Multiple tool calls should run as one deterministic operation ## When to use Lobster | User intent | Use Lobster? | | ------------------------------------------------------ | --------------------------