codex/skills/forensic-elicitation/SKILL.md
Forensic elicitation from prior Codex/coding-agent sessions: mine $seq/$cas/session JSONL, memories, tool traces, commits, PRs, and review receipts into provenance-preserving maps. Trigger for learning from past sessions, reconstructing what happened, extracting improvements/lessons, auditing closure, comparing memories vs traces, or resolving contradictions.
npx skillsauth add tkersey/dotfiles forensic-elicitationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Recover the best available knowledge from prior coding-agent work without flattening the evidence into anecdotes. Treat sessions, tool traces, commits, review records, plans, memories, and outcomes as evidence-bearing traces. Produce one canonical map of what is known, how it is known, what remains uncertain, and what query would most improve the model next.
This skill is intended for implicit selection. Do not wait for the user to name $forensic-elicitation when the request asks for historical/session evidence, prior-run truth reconstruction, improvement extraction, postmortem synthesis, or provenance-preserving lessons from coding-agent work.
Use this skill as the session-forensics wrapper around $seq, with $cas only for claims that depend on CAS review/session receipts. Prefer it over raw seq when the requested output is a synthesized evidence map, contradiction ledger, governing model, confidence ledger, or next-best-query recommendation.
Do not activate it for ordinary current-repo code search, bounded implementation, or a simple present-state question unless the user asks to compare current state against prior sessions, memories, review receipts, or tool traces.
Use this skill when the user asks to:
$seq for historical/session/artifact forensics;$resolve, $review-adjudication, $fixed-point-driver, or $cas run;Do not use this skill for ordinary current-repo code search unless the user explicitly asks for historical/session evidence.
Operate as:
Use this authority ladder. Record the stratum for every claim.
| Stratum | Source class | Authority rule |
|---|---|---|
| S0 | Live current artifacts explicitly queried in the present run: git, gh, build/test output, current files, current CAS records | Highest authority for current-state claims; still bind to tuple/time. |
| S1 | Raw tool outputs inside JSONL sessions: command output, function_call_output, review JSON, GraphQL output, build logs, CAS records/event logs | Highest authority for prior-session event claims. |
| S2 | Session event metadata: session_meta, timestamps, cwd, source, git commit, parent/child thread ids, update_plan, goal updates, agent lifecycle | Authoritative for chronology and orchestration shape. |
| S3 | Final assistant answers and progress messages | Useful claims, but must be checked against S1/S2 for material facts. |
| S4 | Session-produced artifacts and persisted summaries referenced by traces | Strong if path/timestamp and content are available; otherwise cite as artifact reference only. |
| S5 | Memories, MEMORY.md entries, rollout summaries, remembered claims | Context and search beacons; never closure proof alone. |
| S6 | Inference/intuition | Allowed only when labeled as inference with the evidence that motivated it. |
Separate claims into these buckets before synthesizing:
Maintain these internal ledgers while querying:
{
"id": "E##",
"claim_fragment": "short factual fragment",
"source_ref": "path:line or artifact path",
"timestamp": "ISO-8601 if available",
"stratum": "S0-S6",
"surface": "tool_output|message|metadata|memory|artifact|commit|cas_record",
"tuple": {"repo": null, "branch": null, "base": null, "head": null, "pr": null},
"verbatim_snippet": "short non-secret excerpt",
"notes": "why this matters"
}
{
"claim_id": "C##",
"claim": "material claim",
"claim_type": "observed|decision|inferred|remembered|contradicted|unsupported|open_question",
"supporting_evidence": ["E##"],
"contrary_evidence": ["E##"],
"confidence": "high|medium|low|blocked",
"confidence_reason": "brief reason",
"next_query": "query that would most improve or falsify this claim"
}
{
"event_id": "T##",
"when": "ISO timestamp or ordered range",
"actor": "root|subagent|tool|reviewer|user|memory",
"session_id": "...",
"source": "path:line",
"tuple": {"base": "...", "head": "...", "pr": "..."},
"event": "what happened",
"evidence": ["E##"],
"effect_on_model": "why the event changes the reconstruction"
}
Prefer $seq for session/memory/artifact forensics. Use native seq surfaces before raw shell/JSON parsing.
Scope and inventory
seq artifact-search --root ~/.codex/sessions \
--contains-any "<topic terms, symbols, commits, PR numbers, skill names>" \
--since <iso> --until <iso> \
--surface auto --stats --limit 50 --format jsonl
Also run a low-specificity recall query with only one or two durable terms. Exact keywords often miss the governing pattern.
Find candidate sessions
seq find-session --root ~/.codex/sessions --contains "<distinct prompt/output term>" --format table
seq workdir-report --root ~/.codex/sessions --workdir <repo-path> --mode sessions --format table
Read the transcript without skill-block noise
seq session-prompts --session-id <id> --roles user,assistant \
--strip-skill-blocks --limit 80 --format jsonl
Interrogate tool traces
seq session-tooling --path <jsonl> --summary --group-by command --format table
seq tool-search --root ~/.codex/sessions --session-id <id> \
--contains-any "git,gh,zig,cas,jq,reviewVerdict,structuredFindingCount,Build Summary" \
--mode rows --format jsonl
seq tool-audit --root ~/.codex/sessions --workdir <repo-path> --group-by executable --format table
Search contradiction beacons
Search for terms that indicate state changes, disagreements, or unreliable closure:
seq artifact-search --root ~/.codex/sessions \
--contains-any "clean,findings,patch is incorrect,No findings,blocked,failed,stale,inProgress,MissingReceiptStatus,tuple,baseSha,headSha,unresolved,current head,Goal marked complete" \
--workdir <repo-path> --surface auto --stats --format jsonl
Inspect orchestration and concurrency
seq orchestration-concurrency --root ~/.codex/sessions --path <jsonl> --format table
seq workflow-audit --root ~/.codex/sessions --workflow fixed-point-driver --mode report --format markdown
seq adjudication-audit --root ~/.codex/sessions --session-id <id> --format jsonl
Mine memory, but demote it
seq memory-map --memory-root ~/.codex/memories --contains "<topic>" --format table
seq memory-history --memory-root ~/.codex/memories --contains "<topic>" --format jsonl
seq memory-provenance --memory-root ~/.codex/memories --contains "<memory phrase>" --format jsonl
Use memory hits as search beacons or remembered summaries until corroborated by raw session/tool evidence.
Use next_action from artifact-search
When seq artifact-search returns next_action_kind / next_action, prefer that command as the next drill-down unless it conflicts with the active hypothesis test.
When a claim depends on CAS review, never accept “CAS clean” without tuple binding.
Required checks:
baseSha equals the PR/base tuple under discussion.headSha equals the exact commit under discussion.targetFingerprint binds the same base/head.reviewResultAvailable is true and turnStatus is terminal.structuredFindingCount and rawFindingCount agree, or the disagreement is explained.reviewVerdict.clean / findingCount agrees with the raw review text.Useful commands:
cas review_session receipt --path <record.json> --format json --summary
jq '{clean,structuredFindingCount,rawFindingCount,reviewVerdict,reviewResultAvailable,baseSha,headSha,turnStatus,failureCode,failureHint,recordPath,eventLogPath}' <record.json>
cas review_session lane status --lane-id <lane_id> --json
cas review_session lane stop --lane-id <lane_id> --json
If the receipt summarizer fails but the record/event log has terminal fields, classify this as a tooling gap, not automatically as review failure. Preserve both surfaces and explain which one has authority for which claim.
If a CAS output file is empty while a lane is still running, classify it as pending. Do not start duplicate reviews against the same tuple unless the previous lane is terminal, stale, or unrecoverable.
Record the exact question, repo/workdir, time window, session ids, PR number, base/head commits, branch, and expected surfaces. If the user gives only a vague topic, infer a broad first query, then tighten from evidence.
Build a session graph:
session_id across multiple files;Do not equate filename with session identity. Do not equate final answer with final truth.
From each relevant surface, extract:
Promote raw tool outputs and records over assistant summaries. Remove duplicates created by mirrored event_msg agent_message and response_item message rows. Keep both if one has metadata absent from the other.
For each closure, repair, or “no issue” claim, seek at least two independent surfaces, e.g.:
If only one surface exists, label confidence accordingly.
When evidence conflicts, widen search around the conflict rather than smoothing it away. Search the same tuple, timestamp neighborhood, session id, commit hash, reviewThreadId, recordPath, finding title, and tool failure string.
Common beacons:
Name the governing model that best explains the traces. Good hypotheses are structural, not just descriptive:
For each hypothesis, ask:
$seq or $cas query would find it?Stop only when additional searches stop changing:
If time or context runs short, emit a partial map and name the unsaturated surfaces explicitly.
Return this canonical map unless the user requests a different format.
Group by governing event or claim, not by search result. For each row include provenance.
| Claim/Event | Type | Evidence | Stratum | Status |
|---|---|---|---|---|
| ... | observed/decision/inferred/... | path:line, timestamp, artifact path | S# | confirmed/contradicted/open |
List sources used, authority rank, freshness/closeness, and what each source can and cannot prove.
Name each tension, cite both sides, explain why it matters, and state the next query or resolution.
One coherent explanation of the system behavior, workflow, or failure/improvement pattern.
| Claim | Confidence | Why | What would lower/raise confidence | |---|---|---|---|
List absent surfaces, stale/incomplete receipts, missing artifacts, unqueried memories, or unreachable logs.
Give exactly one highest-yield query or command, with why it dominates alternatives.
Compact statement of what the user should believe or do next.
### Finding: <canonical name>
Observed facts:
- <fact> — `<path>:<line>`, <timestamp>, S#.
Decision/action:
- <action> — `<path>:<line>`, <timestamp>, S#.
Inference:
- <pattern>, inferred from E## + E##. Confidence: <level>.
Contradictions/tensions:
- <counterevidence> — `<path>:<line>`, <timestamp>, S#.
Reusable lesson:
- <lesson>.
Next query:
- `<command>` because <reason>.
tools
Invokes Apple's macOS 27 fm command-line tool from a local Mac to use the on-device system model or Private Cloud Compute, including instructions, image prompts, schema-constrained JSON, and noninteractive automation. Use when the user asks to run Apple Foundation Models through fm, compare system versus pcc, generate structured output, or automate fm without Swift or an app.
development
Compile historical Codex sessions into governed counterfactual evidence, evaluate an existing owner-applied candidate through blinded paired HCTP trials, and fold observable evidence into RUN, OBSERVE, or STOP. Use for `$hylo`, CRF extraction, counterfactual replay, source-governed direct or historical trials, sealed evidence, paired baseline/candidate evaluation, causal frontiers, or evidence-governed improvement.
testing
Ensure a `ledger` command is available on PATH; materialize, validate, record, replay, and project requested Actuating artifacts without taking semantic or execution authority; coordinate the shared Learnings/Synesthesia/Negative Ledger lifecycle checkpoint and repo-local source-memory reconciliation; address Universalist plans and receipts; and perform pure artifact validation.
testing
Classify and quotient review findings, failing tests, incidents, bug reports, migration failures, and other witnessed falsifiers against accepted intent and the current Construction. Author counterexample-set/v1 without selecting repairs, counting review credit, or granting mutation.