egregore-labs/egregore / .claude/skills/deep-reflect
deep-reflect
VerifiedRun deep, multi-hop research over org memory to answer a question or cross-reference an insight, with a cited synthesis. Use for /deep-reflect — not one-shot recall (/search) or capturing an insight (/reflect).
| File | Kind | Size |
|---|---|---|
| REPORT.md | markdown | 9.7 KB |
| RESEARCH.md | markdown | 9.5 KB |
| ROLES.md | markdown | 9.3 KB |
| SKILL.md | skill md | 15.9 KB |
ROLES.md
View on GitHub# ROLES.md — agent contracts
Prompts and output schemas for every subagent the engine spawns. Contracts are **tier-silent** — no model names anywhere; spawns pass no model override and inherit the session tier. Each prompt must be self-contained: subagents inherit nothing from the main conversation.
**Two bindings, one contract.** When schema-validated subagent spawning is available and permitted in this session, bind each role's schema there and validation is enforced by the harness. Otherwise, use foreground subagent delegation when available and permitted in this session; otherwise perform the role inline under the same contract, with provenance marked `verification: self-checked`. For the foreground or inline fallback, append to every prompt: `Return ONLY valid JSON matching the schema below. No markdown fences, no explanation.` — one repair attempt on invalid JSON, then continue with whatever role outputs succeeded; synthesis works with partial input.
Every prompt begins with the same context block:
> You are a research subagent inside Egregore, an org whose shared memory lives as markdown under `memory/` (absolute path: {MEMORY_PATH}). The org is researching: "{QUESTION}" (sub-questions: {SUB_QUESTIONS}). Your final output is consumed by an orchestrator as data.
## Frontmatter — two generations, both real
Files carry EITHER new-style YAML (`title:`, `date:` or `created:`, `author:` or `researcher:`/`by:`, `topics: [..]`, `quests: [..]`, `status:`) OR old-style bold-field headers (`**Date**:`, `**Author**:`, `**Topics**:`). Parse both, honoring the synonyms. When neither exists, derive date/author from the filename (`YYYY-MM-DD-author-slug.md`, `DD-author-topic.md` in monthly dirs). Never report a file as unattributed or undated without checking all three.
## Scout (SEED — 2 in parallel)
Mission: build the initial frontier. You may hypothesize what you expect to find, but you may NOT assert any finding as real — that requires evidence you don't have yet.
Inputs: question, sub-questions, corpus-probe results, prior-research compounding leads (`RESEARCH.md` §Compounding), and (connected) the graph orientation results.
Actions budget: ≤3 `bash bin/search.sh query "..." --fast -n 5` with DIFFERENT wordings (one keyword-ish, one conceptual); frontmatter/topic greps (`grep -rl "topics:.*{term}" memory/knowledge/`); `memory/quests/index.md` + `memory/handoffs/index.md` scans. **Scout #1's prompt additionally grants the run's single best-available-tier search probe (no `--fast` flag); scout #2 is `--fast`-only** — the main loop writes this into each prompt so the budget needs no coordination. Count result blocks, never the banner hit count.
```json
{
"candidates": [{"path": "memory/...", "hypothesis": "why this doc should matter"}],
"probes_run": ["..."],
"gap_hypotheses": ["topics that SHOULD have coverage but probes found none"]
}
```
Max 12 candidates across both scouts after the main loop merges. Prefer breadth — convergence needs sources from different directories and authors. The main loop pairs your `gap_hypotheses` with your `probes_run` when it enters them into the gap register.
## Reader (HOP WAVES — 2-4 per wave)
Mission: read assigned files IN FULL, in your own context, and extract claims + leads. Titles and topics are hints, not evidence — your claims must be grounded in what the text actually says.
Inputs: 3-6 file paths (read each file yourself at its supplied path), the question + sub-questions, the current seen-set (paths only, for lead dedup), and in cross-ref mode the relation instruction below.
Hard rules:
- No claim without a verbatim excerpt (≤30 words) copied exactly from the file — it will be mechanically re-checked; a fabricated or paraphrased excerpt kills the claim.
- Weight every claim: `primary` (should change what the user does next), `secondary` (worth knowing), `ambient` (context).
- Irrelevant assigned file → say so (`relevance: low`) and move on. Don't force significance.
- Extract leads per `RESEARCH.md` §Leads; skip anything in the seen-set.
- Cross-ref mode only: set `relation` per claim — `supports | contradicts | duplicates | depends-on`, derived from which sub-question the claim answers. Never `supersedes` (that verdict belongs to the skeptic's decay check).
```json
{
"claims": [{"claim": "one sentence", "sub_question": "...", "path": "memory/...", "excerpt": "verbatim ≤30 words", "date": "YYYY-MM-DD", "author": "...", "weight": "primary|secondary|ambient", "relation": "cross-ref mode only"}],
"leads": [{"type": "doc-link|quest|person|session|pr|topic-term|named-absent", "ref": "...", "why": "one line", "from": "citing path"}],
"contradiction_flags": [{"between": ["path-or-claim", "path-or-claim"], "note": "..."}],
"file_verdicts": [{"path": "...", "relevance": "high|med|low"}]
}
```
The main loop assigns each claim a stable `id` on merge; you never number your own claims.
## Analyst (PATTERN — 2 in parallel, de-correlated)
Mission: find structure across the ledger's claims. You receive the id-carrying claims table and contradiction flags — NOT the other analyst's output, intentionally: fresh reads without anchoring.
**Convergence analyst** — receives claims sorted chronologically. Look for: independent agreement (distinct authors/dirs arriving at the same conclusion), evolution arcs (thinking that shifted, and when), clusters, trajectories.
**Tension analyst** — receives claims grouped by sub-question/topic. Look for: contradictions, supersession (a newer claim quietly replacing an older one), drift (vocabulary or position changing without a recorded decision), voids (what the claims collectively assume but never establish).
Hard rules:
- Every pattern names its supporting claims by their stable `id`s. No pattern without ≥1 claim (voids cite what SHOULD exist but doesn't; the main loop routes voids into the gap register for the skeptic's absence audit).
- Describe patterns in free language, tagged with a structural role. **The role vocabulary is open**: `cluster / bridge / void / trajectory / recurrence / contradiction / drift / convergence` are the common labels — coin a new one when the structure genuinely demands it, and define it in the description.
- "The claims are routine; nothing structural" is a valid finding. Don't manufacture significance.
```json
{
"patterns": [{"role": "free-form structural label (common: cluster|bridge|void|trajectory|recurrence|contradiction|drift|convergence)", "description": "free-form, specific", "claim_ids": [1, 4], "weight": "primary|secondary|ambient"}],
"notes": "free-form observations that don't fit the schema"
}
```
## Skeptic (VERIFY — 1-2 in parallel)
Mission: attack every claim and every gap. You see id-carrying claims + cited files + the full gap register — never the analysts' reasoning. When two skeptics run, the main loop partitions claims by id; both receive the whole gap register but only audit their assigned gap ids.
Per claim, in order:
1. **Mechanical check.** Normalize both sides — strip markdown emphasis characters (`*`, `_`, `` ` ``), collapse every whitespace run (including newlines) to a single space, case-fold — then fixed-string search the normalized excerpt in the normalized file text (read the file, or `python3`/`tr`-normalize and grep). Found → step 2. Missing → search the file yourself for text genuinely supporting the claim: found → replace the excerpt with the real text, verdict `corrected`; not found → verdict `killed` (miscite — no paraphrase benefit of the doubt).
2. **Semantic check.** Does the surrounding text carry the claim's weight, or only its title? Overreach → verdict `downgraded` (with a note), not killed.
3. **Decay check.** Evidence older than ~90 days → ONE `search.sh query "{claim terms}" --fast -n 3` (or `SUPERSEDES` edge check when connected). Newer superseding/contradicting artifact → verdict `dated`, cite the newer doc; in cross-ref mode set the claim's `relation` to `supersedes`.
4. Cross-ref mode: preserve the claim's `relation` unless your findings correct it; note any change.
Per gap:
5. **Absence audit.** Re-run the recorded probes PLUS one adversarial probe of your own devising (different vocabulary, different directory). Probe-less gaps (analyst voids): devise ≥2 probes yourself. If you FIND the allegedly-absent doc: verdict `refuted`, return the found path — it enters the ledger as a bonus hop. Otherwise `verified`.
```json
{
"claim_verdicts": [{"claim_id": 1, "verdict": "verified|corrected|downgraded|dated|killed", "note": "...", "corrected_excerpt": "only for corrected", "newer_doc": "only for dated", "relation": "cross-ref mode, only if changed"}],
"gap_verdicts": [{"gap_id": 1, "verdict": "verified|refuted", "found_path": "only for refuted", "extra_probes": ["the probes you added"]}]
}
```
## Failure handling
| Failure | Handling |
|---|---|
| One reader/scout returns invalid JSON | One repair attempt; still invalid → log to provenance, continue partial |
| One analyst fails | Proceed with the other; note the missing lens in the report |
| Both analysts fail | Main loop synthesizes directly from the verified claims table at capped confidence |
| Skeptic fails | Rerun once; else every unchecked claim ships marked `unverified` — never silently skip verification |
| An agent returns zero claims/leads | Valid result. Record it; it feeds the yield saturation test |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| add-product-e2e-evalpaperclipai/paperclipAdd or extend a Paperclip full-stack runner E2E workflow, fixture, matcher, or report evidence path for local or Daytona execution. | Stars: 115k | Updated | Claude CodeCodex | Verified | Install |
| add-runner-evalpaperclipai/paperclipAdd or extend a Paperclip Runner protocol evaluation definition, roster, assertion, or report fixture with provenance and narrow validation. | Stars: 115k | Updated | Claude CodeCodex | Verified | Install |
| diagnose-why-work-stoppedpaperclipai/paperclipCompatibility entry point for failed, stalled, looping, or over-recovered Paperclip work. Use fix-failed-paperclip-run for the full diagnosis, regression, repair, real verification, and green-PR workflow; honor an explicitly requested diagnosis-only scope. | Stars: 115k | Updated | Claude CodeCodex | Verified | Install |
| fix-failed-paperclip-runpaperclipai/paperclipDiagnose and fix failed, stuck, slow, or incorrectly blocked Paperclip tasks and runs. Use with a task/run URL or failure report to trace the root cause, prove a regression red then green, check second-order effects, verify the real workflow, and deliver a PR with passing checks. | Stars: 115k | Updated | Claude CodeCodex | Verified | Install |