rehydrate
Full AI-powered context recovery via Gemini/Codex. Use after compaction or when context feels stale.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Full AI-powered context recovery via Gemini/Codex. Use after compaction or when context feels stale.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Quick orientation on project state. Reads .agent/ files and git history — no AI calls, finishes in seconds.
Independent dual-backend review of the project's MD doc set for drift, contradictions, dead pointers, and bloat. Sends CLAUDE.md + every README*.md to Gemini AND Codex in parallel; synthesizes findings into a single report.
Selectively prune redundant lines from .agent/FULL_CONTEXT.md via AI (Gemini/Codex). Use when FULL_CONTEXT.md has grown large (500+ lines). Distinct from /compact (Claude Code built-in, which summarizes the live conversation).
Copy content to clipboard in a format suited to the target (Slack, Markdown, plain text). Use when the user says "clip", "copy that", "clipboard", or "/copy".
Update megavibe and restart this session with new hooks/rules/skills
| name | rehydrate |
| description | Full AI-powered context recovery via Gemini/Codex. Use after compaction or when context feels stale. |
Regenerate your session-scoped WORKING_CONTEXT.md from the durable .agent/ files using Gemini or Codex.
This is the heavy-duty recovery tool — it calls an AI backend and writes a fresh working context. For quick orientation without AI calls at session start, use /catchup instead. After compaction you do NOT need /catchup — the on-compact hook already inlined that orientation into its systemMessage, so /rehydrate is the only slash command to run.
A real session once hung for 19 minutes because rehydrate piped a 234 KB FULL_CONTEXT.md + 140 KB DECISIONS.md to Gemini with no timeout. Don't repeat it:
.agent/ corpus at a backend. Send a bounded slice (step 3). The full files stay the durable source.timeout/gtimeout, so the portable form is perl -e 'alarm shift; exec @ARGV' <secs> <cmd...>.Determine your session ID and WORKING_CONTEXT path.
session_id); WORKING_CONTEXT lives at .agent/sessions/{session_id}/WORKING_CONTEXT.md.Check backend availability (standard fallback chain): mcp__gemini-cli__ping → $GEMINI_API_KEY curl → Codex MCP → Claude subagent (always works).
Assemble a BOUNDED input via Bash (caps keep it well under any backend limit and fast):
SID="<your-session-id>"
IN=".agent/LOGS/rehydrate-input.${SID}.md"
{
echo "# git"; git status --short --branch 2>&1 | head -40; git diff --stat 2>&1 | tail -30
echo; echo "# TASKS.md"; cat .agent/TASKS.md 2>/dev/null
echo; echo "# LESSONS.md (recent)"; tail -200 .agent/LESSONS.md 2>/dev/null
echo; echo "# DECISIONS.md (recent)"; tail -300 .agent/DECISIONS.md 2>/dev/null
echo; echo "# FULL_CONTEXT.md (origin + recent)"
head -30 .agent/FULL_CONTEXT.md 2>/dev/null; echo "...[older entries elided — see file]..."
tail -500 .agent/FULL_CONTEXT.md 2>/dev/null
} > "$IN"
wc -c "$IN" # sanity-check: if much over ~200 KB, tighten the tails and rebuild
Call the backend, time-bounded, writing straight to WORKING_CONTEXT:
OUT=".agent/sessions/${SID}/WORKING_CONTEXT.md"; mkdir -p "$(dirname "$OUT")"
PROMPT=$(printf '%s\n\n%s' \
"Read the project state below and write a WORKING_CONTEXT.md (max 400 lines) with sections: Goal; Constraints (must-not-break); What's Done (files touched); Open Tasks (+acceptance criteria); Risks/Unknowns; Next Actions (3 concrete). Output ONLY the markdown." \
"$(cat "$IN")")
perl -e 'alarm shift; exec @ARGV' 150 gemini -p "$PROMPT" > "$OUT" 2>/dev/null
$OUT = that backend FAILED. Don't retry it — move down the chain.$GEMINI_API_KEY curl (--max-time 150) → Codex (perl -e 'alarm shift; exec @ARGV' 150 codex exec "$PROMPT") → Claude subagent (Agent tool, model sonnet — internal, cannot hang, always finishes).mcp__gemini-cli__ask-gemini instead, but it is NOT time-boundable from here. If it doesn't return within ~3 min, abandon it and use the Bash path above — do not keep waiting.Verify + load. Confirm $OUT is non-empty and contains the requested sections, then Read it into your window. If every external backend failed AND the subagent is unavailable, hand-write a minimal WORKING_CONTEXT from TASKS.md + git state rather than leaving it empty.
poma_search with key terms from TASKS.md to supplement the input./catchup isn't enough — you need full AI-powered recovery