Skip to content

Commit ae1adec

Browse files
fix(agent): surface pending capsule review details (#38)
* fix(agent): surface pending capsule review details * fix(skill): require explicit capsule review choice * fix(skill): keep capsule review handoff concise * test: replace brittle guidance text assertions
1 parent 26eb6f2 commit ae1adec

4 files changed

Lines changed: 147 additions & 1 deletion

File tree

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Pending Capsule Review Summary Implementation Plan
2+
3+
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
4+
5+
**Goal:** Ensure agents list every pending capsule candidate in the user's language whenever a final response still requires review.
6+
7+
**Architecture:** Add matching behavioral contracts to the generated global AGENTS guidance and the packaged `rgit-capture` skill. Keep translation in the presentation layer and preserve proposal ids, capsule names, code symbols, configuration keys, file paths, and stored records.
8+
9+
**Tech Stack:** Python string rendering, Markdown skill instructions, pytest, isolated Codex behavior validation.
10+
11+
**Spec:** `docs/superpowers/specs/2026-07-19-pending-capsule-review-summary-design.md`
12+
13+
## Global Constraints
14+
15+
- No new CLI command, dependency, or storage schema.
16+
- List every candidate as stored name plus one-line intent; include key knobs only when they affect the choice.
17+
- A candidate count alone is not an acceptable final review summary.
18+
- Translate explanatory prose and intent into the user's current language, but preserve stable identifiers and stored data.
19+
20+
---
21+
22+
### Task 1: Define the host-agent behavior check
23+
24+
- [ ] Create an isolated Git repository with a real `.rgit/` store and one
25+
open proposal containing multiple English-language candidates.
26+
- [ ] Load the branch versions of the global guidance and `rgit-capture`
27+
skill, then ask an isolated Codex session to finish in another language
28+
without approving, dismissing, or rewriting the proposal.
29+
- [ ] Verify the final response includes every candidate and key choice-relevant
30+
knob, preserves stable identifiers, requests the user's decision, and
31+
leaves the stored proposal unchanged.
32+
33+
---
34+
35+
### Task 2: Add the matching instruction contracts
36+
37+
**Files:**
38+
- Modify: `src/rgit/agent_guidance.py`
39+
- Modify: `src/rgit/_plugin/skills/rgit-capture/SKILL.md`
40+
41+
**Interfaces:**
42+
- Consumes: pending proposal data already available from `rgit pending --json`.
43+
- Produces: agent instructions only; no runtime API changes.
44+
45+
- [ ] **Step 1: Update global final-feedback guidance**
46+
47+
Replace the current state-only sentence with a compact rule that lists pending
48+
proposal details, follows the user's current language, preserves identifiers,
49+
and forbids count-only summaries.
50+
51+
- [ ] **Step 2: Add the capture-skill final-response fallback**
52+
53+
After the normal review instructions, require the same presentation whenever a
54+
proposal remains open at the end of a response.
55+
56+
- [ ] **Step 3: Run the existing focused tests**
57+
58+
Run: `python -m pytest tests/test_agent_guidance.py tests/test_installer.py tests/test_guidance_coupling.py -q`
59+
60+
Expected: existing guidance coupling and packaging tests pass without
61+
hard-coding the new prose in test assertions.
62+
63+
- [ ] **Step 4: Run the full suite**
64+
65+
Run: `python -m pytest -q`
66+
67+
Expected: all tests pass with no new warnings or failures.
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Pending Capsule Review Summary
2+
3+
**Date:** 2026-07-19
4+
**Status:** approved
5+
6+
## Problem
7+
8+
When a run ends with open research-git proposals, an agent can report only the
9+
number of capsule candidates awaiting review. The user cannot make the required
10+
human decision because the final response omits the candidates' concrete
11+
contents.
12+
13+
The capture skill already asks the agent to show each candidate during the
14+
normal review step, but the global guidance has no equivalent requirement for
15+
the final response. There is also no fallback in the skill for a turn that ends
16+
before the review decision is complete.
17+
18+
## Design
19+
20+
Use the same compact review contract in both instruction layers:
21+
22+
- The global AGENTS guidance requires final feedback to report open proposals.
23+
For every open proposal, list its stable proposal id and every candidate's
24+
stored name plus a one-line explanation of its intent. Include key knobs only
25+
when they affect the user's choice. A count alone is not sufficient.
26+
- The `rgit-capture` skill keeps its normal interactive review flow and adds a
27+
final-response fallback. If any proposal remains open when the agent is about
28+
to finish, the agent presents the same candidate list and asks which names to
29+
keep.
30+
- User-facing explanations follow the language the user is currently using,
31+
regardless of the language stored in the capsule. Proposal ids, capsule names,
32+
code symbols, configuration keys, and file paths remain unchanged.
33+
- Translation is presentation-only. It never changes candidates stored under
34+
`.rgit`.
35+
36+
## Output Shape
37+
38+
```text
39+
Pending capsule review
40+
41+
Proposal prop_abc:
42+
- reranking-retrieval: Add a reranking stage before final retrieval.
43+
- cache-fallback: Fall back to uncached retrieval when cache lookup fails.
44+
Key knob: fallback_timeout
45+
46+
Tell me which capsule names to keep. Nothing is approved until you decide.
47+
```
48+
49+
For a Chinese-speaking user, the intent and surrounding prose are presented in
50+
Chinese while `prop_abc`, `reranking-retrieval`, `cache-fallback`, and
51+
`fallback_timeout` remain unchanged.
52+
53+
## Testing
54+
55+
- Run an isolated host-agent behavior check against a real pending proposal
56+
with multiple candidates and a user language different from the stored
57+
intents.
58+
- Verify the final response lists every candidate, translates presentation
59+
text, preserves stable identifiers, requests a review decision, and leaves
60+
the stored proposal unchanged.
61+
- Keep guidance coupling and installer packaging tests passing.
62+
63+
## Out of Scope
64+
65+
- New CLI commands or output formats.
66+
- Changes to proposal or capsule storage schemas.
67+
- Translating or rewriting stored capsule records.
68+
- Truncating candidate lists. The final response lists every candidate.

‎src/rgit/_plugin/skills/rgit-capture/SKILL.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ Lost the ids from step 2? Bare `rgit review` re-lists every open proposal with i
6666

6767
4. Echo the `approved -> <feature_id>` lines back to the user, then continue to step 6.
6868

69+
If any proposal remains open when you are about to finish a response, include a `Pending capsule review` section before finishing. List each proposal id and every candidate's stored name and one-line intent; include key knobs only when they affect the choice. Never replace this list with only a candidate count. Present the explanations and intents in the language the user is currently using, even when the stored capsule uses another language. Do not translate proposal ids, capsule names, code symbols, configuration keys, or file paths. Translation is presentation-only; never rewrite the stored candidates.
70+
71+
Keep the handoff compact. Do not add a separate Git, capsule, or graph status list unless the user explicitly asked for those details. After the candidate list, end with exactly one short paragraph in the user's language that combines the unresolved status and decision request: ask which capsule names to keep, whether to keep all, or whether to discard all; state in the first person that you will execute the review for the user and that kept candidates will be approved and stored as capsules. Do not repeat candidate names as reply examples, render a separate decision menu, or say only that review "can" be executed. Do not approve, discard, or otherwise make a review decision before the user confirms.
72+
6973
### 6. Infer graph edges (deterministic baseline + agent-judged relationships)
7074

7175
After approval, wire the new capsules into the graph:

‎src/rgit/agent_guidance.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,14 @@ def render_global_block(mode: str = "default") -> str:
8888
"scan` stages a plan (plain `rgit init` offers it), then the "
8989
"`rgit-digest` skill drains the queue batch by batch.\n"
9090
"- In final feedback, mention any capsules created, approved, applied, "
91-
"or skipped, plus important graph relations.\n"
91+
"or skipped, plus important graph relations. If open proposals awaiting "
92+
"review remain, list each proposal id and every candidate's stored name "
93+
"and one-line intent; include key knobs only when they affect the choice. "
94+
"A candidate count alone is not enough. Present explanations in the "
95+
"language the user is currently using, regardless of the stored capsule "
96+
"language. Keep proposal ids, capsule names, code symbols, configuration "
97+
"keys, and file paths unchanged; translation is presentation-only and "
98+
"must not modify the stored capsule.\n"
9299
)
93100
provisional = f"{START}\n{body}{END}\n"
94101
h = canonical_hash(provisional)

0 commit comments

Comments
 (0)