# civyk-repoix Tools

**Repoix Mode**: Check `context.tool_state.repoix_mode` from JSON response.
- `mcp` -> Use MCP tool calls
- `cli` -> Use `civyk-repoix query` commands
- **`none` -> SKIP this entire section. Use Read, Grep, Glob for manual exploration.**

> **IMPORTANT: IF REPOIX_MODE == "none", do NOT attempt any tool calls listed below. Instead use: Read (examine files), Grep (search patterns), Glob (find files by name). Proceed to the next section of the prompt.**

Mode is auto-detected and cached. No manual detection needed.

## AI Context Cache Protocol

**Skip when REPOIX_MODE == "none".**

**BEFORE reading any file:**

```text
# Check what's cached from earlier stages
understand(action="stats", limit=50)
understand(action="recall", target="<file_path>")
# IF found AND fresh: Use cached analysis, skip file read
# IF not found: Read file, then MUST store understanding
```

**AFTER reading any source file:**

```text
understand(
  action="store",
  scope="file",
  target="<file_path>",
  purpose="<what this file does>",
  importance="<critical|high|medium|low>",
  key_points=["<main functionality>", "<key patterns>"],
  gotchas=["<edge cases>", "<non-obvious behaviors>"],
  analysis="<detailed analysis capturing architecture, patterns, domain models, and key relationships>"
)
```
