agent/claude/issues/002-ai-context.md
Snider beb24f71d2 docs: add feature request issues for core CLI migration
12 issue files documenting features needed to replace shell scripts:

Claude Code hooks:
- 001: core ai session (state management)
- 002: core ai context (fact capture)
- 003: core ai hook (command validation)
- 004: core qa debug (debug statement detection)

Data collection:
- 005: core collect github (issues/PRs archive)
- 006: core collect bitcointalk (forum threads)
- 007: core collect market (CMC/CoinGecko)
- 008: core collect papers (whitepapers)
- 009: core collect excavate (project archaeology)
- 010: core collect process (HTML→MD)
- 011: core collect dispatch (event hooks)

000: Overview tracking issue

These will be submitted to host-uk/core when rate limit resets.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 18:49:35 +00:00

53 lines
1.4 KiB
Markdown

# feat(ai): Add context fact management for Claude Code
## Summary
Add `core ai context` subcommands to capture and manage context facts that persist across compaction.
## Required Commands
```bash
core ai context add <fact> [--source=X] # Save a context fact
core ai context list # List current facts
core ai context extract <output> # Extract actionables from tool output
core ai context clear # Clear old context (>3h)
```
## Current Shell Scripts Being Replaced
- `claude/scripts/capture-context.sh` - Stores context facts
- `claude/scripts/extract-actionables.sh` - Extracts actionables from core CLI output
## Context Format
```json
[
{"fact": "Use Action pattern not Service", "source": "user", "ts": 1234567890},
{"fact": "FAIL: TestFoo", "source": "core go test", "ts": 1234567891}
]
```
## Extraction Patterns
The `extract` command should parse output from:
- `core go test` / `core go qa` / `core go lint` - Extract ERROR/WARN/FAIL lines
- `core php test` / `core php stan` - Extract FAIL/Error lines
- `core build` - Extract error/cannot/undefined lines
## Storage
- `~/.claude/sessions/context.json`
- Max 20 items, auto-clear after 3 hours of inactivity
## Example Usage
```bash
# Manual fact
core ai context add "User prefers UK English" --source=user
# Extract from piped output
core go test 2>&1 | core ai context extract
# List facts
core ai context list --json
```