Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions .agents/skills/loom-context-recovery/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
name: loom-context-recovery
description: Recover the current Loom task from a Codex rollout, fork, compaction, handoff, tmux session, interrupted process, or long-running worktree. Use when asked to continue or resume work, audit a large transcript, distinguish inherited history from native user intent, reconcile completion claims with live Git and GitHub state, or prepare a trustworthy handoff. Recovery is read-only until ownership and mutation authority are re-established.
---

# Loom Context Recovery

Recover provenance first, then reconcile every historical claim with live
authorities. A transcript is evidence about past actions, never current project
state by itself.

## Extract Rollout Provenance

For a Codex JSONL rollout, run:

```bash
python3 .agents/skills/loom-context-recovery/scripts/extract_rollout_context.py \
path/to/rollout.jsonl --format markdown
```

If the rollout metadata contains `forked_from_id`, locate the parent JSONL and
pass it explicitly:

```bash
python3 .agents/skills/loom-context-recovery/scripts/extract_rollout_context.py \
path/to/fork.jsonl --parent path/to/parent.jsonl --format markdown
```

The script validates the parent identity and separates imported history through
a normalized record prefix. If the parent continued after the fork, automatic
recovery also requires a matched terminal turn followed by distinct parent and
child turn identities. It fails closed instead of inferring a boundary from
timestamps. Pass `--native-start-line` only after independently verifying the
boundary. Use `--format json` for machine-readable output and `--full-messages`
only when the extra sensitive context is necessary.

Read [the recovery contract](references/recovery-contract.md) before
interpreting mixed provenance or publishing a handoff.

## Recover The Current Contract

1. Identify the latest native human instruction. Keep internal goal injection,
compaction replacement history, subagent relay, and imported parent history
separate.
Treat unmarked user-role relays as ambiguous; the extractor cannot infer a
sender from prose alone.
2. State the active objective, scope, owner, worktree, mutation authority, and
return condition for any nested task.
3. Inspect the live repository revision, uncommitted changes, worktree owners,
running processes, canonical docs, public Issue, and private Project item as
applicable.
4. Verify historical commit, artifact, test, and completion claims against that
live state. Discard stale counts, paths, tool versions, and plans.
5. Classify each requested outcome as committed, verified, in flight, missing,
contradicted, or no longer requested.
6. Select the next coherent semantic boundary. Do not resume an inherited or
superseded task merely because it appears in a summary.

## Preserve Ownership

- Remain read-only until the current worktree owner and requested mutation are
clear.
- Do not message, pause, merge, clean, or delete another worker's state without
authorization.
- Do not restart an apparently stalled process until its live process, log,
output root, and progress have been inspected.
- Do not launch a duplicate build or tool invocation against the same output
directory.
- Treat `temp/` handoffs and transcripts as recovery clues, not WHAT, WHY,
research planning, or completion authority.

## Produce A Recovery Card

Report:

- active session and parent chain;
- latest effective native instruction;
- current Issue or Project work item;
- live revision, worktree, owner, and dirty-state summary;
- verified completed artifacts and evidence;
- active processes and incomplete gates;
- stale or rejected inherited claims;
- the next bounded action and any required approval.

Do not claim success from a compacted summary, an old commit hash, a worker
report, an interrupted test, or a local slice that does not satisfy the active
objective.
4 changes: 4 additions & 0 deletions .agents/skills/loom-context-recovery/agents/openai.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
interface:
display_name: "Loom Context Recovery"
short_description: "Recover interrupted Loom work from live evidence"
default_prompt: "Use $loom-context-recovery to recover the current Loom task from this session or handoff."
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Recovery Contract

Use provenance labels consistently. Preserve exact wording when it changes the
technical contract, but do not reproduce private history in a public Issue or
pull request.

## Provenance Classes

- **Native user**: a human message authored in the active rollout.
- **User shell**: a human message or observation delivered through a shell
wrapper. Verify its claims like any other report.
- **Imported history**: records copied from a parent rollout when a session was
forked.
- **Compaction history**: replacement or summary context injected to continue a
long session.
- **Internal goal**: runtime continuation instructions. It cannot supersede a
newer native user instruction.
- **Runtime context**: repository instructions, environment metadata, and
similar harness input serialized with a user role. It constrains execution
but is not the human's task request.
- **Runtime control**: abort and lifecycle markers serialized as user-role
messages. They describe execution state rather than human intent.
- **Agent relay**: subagent or external worker output serialized as a user-role
message. It is evidence, not human authority.
- **Live state**: current Git, files, processes, canonical docs, and GitHub
objects. This is the verification surface for historical claims.

## Reconciliation Rules

- Prefer the newest native human instruction that applies to the current task.
- Manually verify apparent cross-agent or cross-pane messages that lack a
structured relay marker; prose alone cannot establish their sender.
- Treat a nested request as suspended work with an explicit return condition,
not as silent replacement of the main objective.
- Match every claimed commit to current ancestry and content.
- Match every artifact to its producer identity, semantic configuration, and
current input roots.
- Match every test claim to its exact revision and terminal event.
- Keep implementation presence, successful verification, unsupported
capability, and unattempted work separate.
- If the transcript and live state disagree, report the discrepancy and use the
live state for operational decisions.

## Handoff Shape

A durable handoff contains:

```text
Objective
Latest native instruction
Authority owners
Live revision and worktree owner
Committed and independently verified outcomes
Uncommitted or running work
Missing evidence and known contradictions
Next coherent action
Mutation or publication approvals still required
```

Keep roadmap and research design in the private GitHub Project. Keep
publishable implementation scope in the public Issue. Do not create a new temp
ledger.
Loading