| name | yams |
| description | Code indexing, exact/semantic search, graph-assisted code navigation, and project memory |
| license | GPL-3.0 |
| compatibility | opencode |
| metadata | {"tools":"cli, mcp","categories":"search, indexing, memory, knowledge-graph"} |
YAMS Skill (agent.md)
Quick Reference
yams status
yams daemon start
yams doctor
yams add <file>
yams add . -r --include "*.py"
yams watch
yams grep "pattern" --cwd .
yams grep -e "--flag" --cwd .
yams grep -g "*.cpp" "TODO"
yams grep --minimal "TODO"
yams search "query"
yams graph --explore <query>
yams graph --name <file>
yams graph --list-types
yams graph --relations
yams graph --search "pattern"
yams list --format json
yams list --show-metadata
Agent Memory Workflow
YAMS is the single source of truth for agent memory and work item.
Required Metadata (Task Tracking)
Attach metadata to every yams add.
task - short task slug (e.g., list-json-refresh)
phase - start | checkpoint | complete
owner - agent or author
source - code | note | decision | research
Index Project Files
yams add . -r --include "*.ts,*.tsx,*.js"
yams add . -r --include "*.py" --exclude "venv/**,__pycache__/**"
yams add src/ -r --metadata "task=list-json-refresh,phase=checkpoint,owner=codex,source=code"
Auto-Index with Watch
yams watch
yams watch --interval 2000
yams watch --stop
Verify Indexing
yams status
yams list --limit 10
Search Patterns
Decision Tree
- Code patterns →
yams grep (fast, regex/literal; use --cwd . for repo scoping)
- Semantic/concept →
yams search (embeddings/hybrid)
- Codebase shape / blast radius →
yams graph --explore from a search/grep hit
- Path/tree/topology inspection → use
yams graph, not retired top-level tree
- No results from grep → Try
yams search, then follow graph_explore_hint when present
grep (Code Search)
yams grep "function authenticate"
yams grep "async.*await.*fetch"
yams grep "TODO" -A 2 -B 2
yams grep "import" --ext py
yams grep -g "src/**/*.cpp" "TODO"
yams grep --minimal "TODO" -g "src/**/*.cpp"
yams grep "TODO" --cwd .
yams grep "TODO" --cwd src/daemon
yams grep "user?.name" -F
yams grep "TODO" -m 5
yams grep -- "--tags|foo" --include="docs/**/*.md"
yams grep --regexp "--tags|foo" -g "docs/**/*.md"
search (Semantic Search)
yams search "error handling patterns"
yams search "authentication flow" --type hybrid
yams search "database connection" --limit 5
yams search "API endpoint" --ext ts
search (Metadata-Only)
yams search "task=example-task" --type keyword --limit 10
yams search "task=example-task" --type keyword --limit 20
yams search "plan" --type keyword --tags plan --limit 10
yams search "tagged logic" --type keyword --tags plan --limit 20
Agent Storage
Store Research
curl -s "https://docs.example.com/api" | yams add - --name "api-docs.md" \
--metadata "task=docs-cache,phase=checkpoint,owner=codex,source=research"
yams add notes.md --metadata "task=research-auth,phase=checkpoint,owner=codex,source=research"
Store Decisions
echo "## Decision: Use JWT for auth
### Context
Need stateless authentication for microservices.
### Decision
JWT with RS256, 15min expiry, refresh tokens.
### Rationale
Stateless, scalable, industry standard.
" | yams add - --name "decision-jwt-auth.md" \
--metadata "task=auth-decision,phase=checkpoint,owner=codex,source=decision"
Retrieve Knowledge
yams search "authentication decision"
yams list --format json --show-metadata \
| jq '.documents[] | select(.metadata.task=="example-task")'
yams list --format json --show-metadata \
| jq '.documents[] | {name,metadata,tags}'
Session Management
Create Work Sessions
yams session start --name "feature-auth"
yams session ls
yams session use "feature-auth"
yams session show --json
Session Scope
yams session add --path "src/auth/**"
yams session warm --limit 100
yams search "login" --session
Session Lifecycle
yams session save
yams session load --name "feature-auth"
yams session clear
yams session close
Graph Queries
Use graph after search/grep finds a likely entry point. Graph answers "what is connected to this?" and should guide local reads, not replace them.
Agent Graph Context
yams graph --explore "authenticateUser" --max-files 3
yams graph --explore src/auth/login.ts --max-files 8
yams graph --explore "RequestHandler" --json
Notes:
yams search and yams grep results may emit graph_explore_hint; run that exact command before broad local search.
--explore is budgeted for agents: entry symbols, related files, relationship summaries, and line-numbered snippets.
- If
--explore fails or looks stale, fall back to raw traversal plus local reads.
Raw Graph Structure
yams graph --list-types
yams graph --relations
yams graph --search "*Controller*"
yams graph --search "auth*"
yams graph --search "handle?Request"
yams graph --list-type function --scope-cwd --limit 50
File / Symbol Relationships
yams graph --name src/auth/login.ts --depth 2 --limit 50
yams graph --name src/main.ts --relation includes --depth 1
yams graph --node-key "func:authenticate" --relation calls --depth 2
yams graph --name src/auth/login.ts --format json
yams graph --name src/auth/login.ts --format dot > graph.dot
Common relations: calls, includes, contains, defined_in, located_in, has_version, semantic_neighbor.
Topology Navigation
yams graph --topology-snapshots
yams graph --topology-clusters
yams graph --cluster <cluster-id>
Use topology when entering an unfamiliar subsystem. Start with medoids for representative files, bridges for cross-subsystem coupling, and core files for local implementation detail.
MCP Integration
YAMS exposes tools via Model Context Protocol for programmatic access.
Start MCP Server
yams serve
yams serve --verbose
Available MCP Tools (Code Mode)
The MCP server exposes a small composite tool surface.
| Tool | Purpose |
|---|
query | Read-only pipeline: search, grep, list, list_collections, list_snapshots, graph, get, status, describe |
execute | Write batch: add, update, delete, restore, download |
session | Session lifecycle: start, stop, pin, unpin, watch (extensions enabled) |
mcp.echo | Echo utility |
Notes:
query and execute accept arrays (steps / operations) and run them in order.
- Each
query.steps[i] result is available to later steps via $prev (e.g., $prev.results[0].hash).
- Use
describe to discover the parameter schema for an operation at runtime.
Example (pipeline: search -> get):
{
"name": "query",
"arguments": {
"steps": [
{"op": "search", "params": {"query": "auth middleware", "limit": 1}},
{"op": "get", "params": {"hash": "$prev.results[0].hash", "include_content": true}}
]
}
}
MCP Configuration
{
"mcpServers": {
"yams": {
"command": "yams",
"args": ["serve"]
}
}
}
MCP Environment Toggles
| Variable | Effect |
|---|
YAMS_DISABLE_EXTENSIONS=1 | Disable YAMS extensions (removes session, disables some methods like logging/setLevel) |
YAMS_DAEMON_SOCKET=/path.sock | Override daemon socket path used by MCP server |
Troubleshooting
yams daemon status -d
yams daemon log -n 50
yams doctor
yams doctor repair --all
yams doctor --fix-config-dims
Environment Variables
| Variable | Purpose |
|---|
YAMS_DATA_DIR | Storage directory |
YAMS_DAEMON_SOCKET | Daemon socket path override |
YAMS_LOG_LEVEL | Logging verbosity |
YAMS_SESSION_CURRENT | Default session |
| docs/skills/yams/SKILL.md | |