feat: RAG everywhere -- every model call sees past context #82
No reviewers
Labels
No labels
Agent
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
joshtronic/igor!82
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/rag-everywhere"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Previously RAG was wired into exactly one path -- the discretionary
site-work Claude block. The other three Claude Code paths (tier-1
issue work, maintenance, PR-review) and all four harness-side
executors (agent-read, agent-post, agent-reflect-read,
agent-reflect-ideas) built their prompts without past-context
retrieval. Cross-tick continuity was a coin flip -- got it for the
one block that knew about it, missed it everywhere else.
Factored a shared lib/rag.sh with two helpers:
ensure_rag_built lazy + idempotent per-tick build. First model
call in a tick pays the ~25s flush+rebuild;
subsequent calls share via a marker file keyed
by $IGOR_TICK_PID (which tick.sh now exports so
child scripts find the same marker). Failures
return non-zero and the caller proceeds with
no context.
rag_query auto-calls ensure_rag_built if needed, then
runs rag.py query -k 5, returns the markdown
blob on stdout. Empty on any failure.
rag_cleanup_marker tick.sh's cleanup traps hook this so the
per-tick marker doesn't accumulate in
$IGOR_STATE_DIR/rag-built/.
Wired into:
tick.sh maintenance Claude path query: "maintenance pass on "
tick.sh PR-review Claude path query: PR title + body
tick.sh tier-1 Claude path query: issue title + body
tick.sh discretionary site-work query: $W_IN_FLIGHT (was: only path)
agent-read.sh query: the URL
agent-post.sh query: the blog idea
agent-reflect-read.sh query: "reading source "
agent-reflect-ideas.py query: the tick's output context
Each user message gets a "## Past context (RAG)" section appended
with the retrieved snippets, or a "(no past context retrieved this
tick)" placeholder when the build/query failed. The placeholder
keeps the prompt shape stable across success and degraded modes so
downstream parsing doesn't need a branch.
agent-reflect-ideas.py is Python; can't source bash directly, so it
invokes lib/rag.sh's rag_query via subprocess with the inherited
env. Same shape, same outcome.
Build cost: ~25s the first time any path needs it in a tick. Ticks
that exit early (no claimable work + no discretionary fire, lock
held, shift gate closed) never call into ensure_rag_built and pay
nothing -- the laziness is the whole point. After the first build
within a tick, all subsequent queries hit redis and return in ~1-2s.
Co-Authored-By: Claude Opus 4.7 noreply@anthropic.com
Previously RAG was wired into exactly one path -- the discretionary site-work Claude block. The other three Claude Code paths (tier-1 issue work, maintenance, PR-review) and all four harness-side executors (agent-read, agent-post, agent-reflect-read, agent-reflect-ideas) built their prompts without past-context retrieval. Cross-tick continuity was a coin flip -- got it for the one block that knew about it, missed it everywhere else. Factored a shared lib/rag.sh with two helpers: ensure_rag_built lazy + idempotent per-tick build. First model call in a tick pays the ~25s flush+rebuild; subsequent calls share via a marker file keyed by $IGOR_TICK_PID (which tick.sh now exports so child scripts find the same marker). Failures return non-zero and the caller proceeds with no context. rag_query <text> auto-calls ensure_rag_built if needed, then runs rag.py query -k 5, returns the markdown blob on stdout. Empty on any failure. rag_cleanup_marker tick.sh's cleanup traps hook this so the per-tick marker doesn't accumulate in $IGOR_STATE_DIR/rag-built/. Wired into: tick.sh maintenance Claude path query: "maintenance pass on <repo>" tick.sh PR-review Claude path query: PR title + body tick.sh tier-1 Claude path query: issue title + body tick.sh discretionary site-work query: $W_IN_FLIGHT (was: only path) agent-read.sh query: the URL agent-post.sh query: the blog idea agent-reflect-read.sh query: "reading source <url>" agent-reflect-ideas.py query: the tick's output context Each user message gets a "## Past context (RAG)" section appended with the retrieved snippets, or a "(no past context retrieved this tick)" placeholder when the build/query failed. The placeholder keeps the prompt shape stable across success and degraded modes so downstream parsing doesn't need a branch. agent-reflect-ideas.py is Python; can't source bash directly, so it invokes lib/rag.sh's rag_query via subprocess with the inherited env. Same shape, same outcome. Build cost: ~25s the first time any path needs it in a tick. Ticks that exit early (no claimable work + no discretionary fire, lock held, shift gate closed) never call into ensure_rag_built and pay nothing -- the laziness is the whole point. After the first build within a tick, all subsequent queries hit redis and return in ~1-2s. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>