regent-cli 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {regent_cli-0.1.0/src/regent_cli.egg-info → regent_cli-0.2.0}/PKG-INFO +1 -1
- {regent_cli-0.1.0 → regent_cli-0.2.0}/pyproject.toml +1 -1
- {regent_cli-0.1.0 → regent_cli-0.2.0}/src/regent/__init__.py +1 -1
- {regent_cli-0.1.0 → regent_cli-0.2.0}/src/regent/initcmd.py +2 -1
- regent_cli-0.2.0/src/regent/templates/skills/regent/SKILL.md +119 -0
- regent_cli-0.2.0/src/regent/templates/skills/regent-stop/SKILL.md +32 -0
- {regent_cli-0.1.0 → regent_cli-0.2.0/src/regent_cli.egg-info}/PKG-INFO +1 -1
- {regent_cli-0.1.0 → regent_cli-0.2.0}/tests/test_initcmd.py +2 -1
- regent_cli-0.1.0/src/regent/templates/skills/regent/SKILL.md +0 -60
- regent_cli-0.1.0/src/regent/templates/skills/regent-stop/SKILL.md +0 -27
- {regent_cli-0.1.0 → regent_cli-0.2.0}/LICENSE +0 -0
- {regent_cli-0.1.0 → regent_cli-0.2.0}/README.md +0 -0
- {regent_cli-0.1.0 → regent_cli-0.2.0}/setup.cfg +0 -0
- {regent_cli-0.1.0 → regent_cli-0.2.0}/src/regent/cli.py +0 -0
- {regent_cli-0.1.0 → regent_cli-0.2.0}/src/regent/doctor.py +0 -0
- {regent_cli-0.1.0 → regent_cli-0.2.0}/src/regent_cli.egg-info/SOURCES.txt +0 -0
- {regent_cli-0.1.0 → regent_cli-0.2.0}/src/regent_cli.egg-info/dependency_links.txt +0 -0
- {regent_cli-0.1.0 → regent_cli-0.2.0}/src/regent_cli.egg-info/entry_points.txt +0 -0
- {regent_cli-0.1.0 → regent_cli-0.2.0}/src/regent_cli.egg-info/top_level.txt +0 -0
- {regent_cli-0.1.0 → regent_cli-0.2.0}/tests/test_doctor.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "regent-cli"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "Autonomous conduction and mediated adversarial deliberation between AI agents, pluggable into any project."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -41,7 +41,8 @@ def _plan(project_root: Path) -> list[tuple[str, Path, str]]:
|
|
|
41
41
|
_template_skill(name)))
|
|
42
42
|
plan.append(("symlink", project_root / ".claude" / "skills" / name,
|
|
43
43
|
f"../../.regent/skills/{name}"))
|
|
44
|
-
plan.append(("file", project_root / ".regent" / "brainstorm" / "
|
|
44
|
+
plan.append(("file", project_root / ".regent" / "brainstorm" / "rounds" / ".gitkeep", ""))
|
|
45
|
+
plan.append(("file", project_root / ".regent" / "plans" / ".gitkeep", ""))
|
|
45
46
|
return plan
|
|
46
47
|
|
|
47
48
|
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: regent
|
|
3
|
+
description: Start or resume the regent activity in this repo — brainstorm (adversarial deliberation round), plan (deliberated plan with steps and gates) or build (execute an approved plan step by step). Single state-driven entry point. Use when the owner says /regent, "retome", "próxima rodada", or asks to continue regent work.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /regent — start or resume the current activity
|
|
7
|
+
|
|
8
|
+
> **Capability level: v0 (file-driven).** State detection is based on files only. There is
|
|
9
|
+
> no `control.json`, no turn lock, no daemon, no confined execution and no atomic abort yet.
|
|
10
|
+
> Immediate interruption of a running step is the user's Esc; `/regent-stop` suspends at the
|
|
11
|
+
> next boundary. Do not claim capabilities beyond this file.
|
|
12
|
+
|
|
13
|
+
## 0. Locate the state roots (deterministic, never guess)
|
|
14
|
+
|
|
15
|
+
- Host projects, current scheme: `ROUNDS = .regent/brainstorm/rounds/` (dirs `ROUND-NNN/`,
|
|
16
|
+
English artifact names) and `PLANS = .regent/plans/` (dirs `PLAN-NNN/`).
|
|
17
|
+
- Host projects, legacy scheme (pre-0.2 seeds): `.regent/brainstorm/rodadas/` with
|
|
18
|
+
`RODADA-NNN/` and PT artifact names (PERGUNTA/RESPOSTA-CLAUDE/OPINIAO-CODEX-N/
|
|
19
|
+
REPLICA-CLAUDE/DECISAO/SUSPENSAO). A legacy host keeps operating on its PT scheme for
|
|
20
|
+
brainstorm; `plan`/`build` ALWAYS use the English `PLANS` scheme.
|
|
21
|
+
- If BOTH `rounds/` and `rodadas/` exist non-empty → corrupted state: report and STOP with
|
|
22
|
+
manual migration instructions (default-deny; never auto-migrate).
|
|
23
|
+
- The regent product repo itself keeps its own deliberation in `docs/brainstorm/rodadas/`
|
|
24
|
+
(dogfood location, PT names) — delimited by that fixed path only.
|
|
25
|
+
|
|
26
|
+
Artifact names below use the English scheme; on a legacy host map brainstorm names to PT.
|
|
27
|
+
|
|
28
|
+
## 1. Detect state (never guess)
|
|
29
|
+
|
|
30
|
+
Open activities (at most ONE may exist):
|
|
31
|
+
- **brainstorm**: a `ROUND-NNN/` without `DECISION.md`.
|
|
32
|
+
- **planning**: a `PLAN-NNN/` without `APPROVAL.md`.
|
|
33
|
+
- **building**: a plan whose `APPROVAL.md` has `status: APPROVED`, with `build/` started and
|
|
34
|
+
no `build/CONCLUSION.md`.
|
|
35
|
+
|
|
36
|
+
An APPROVED plan with no `build/` is NOT open — it is a build candidate awaiting the owner's
|
|
37
|
+
explicit `/regent build`. More than one open activity, or otherwise ambiguous/corrupted
|
|
38
|
+
state → report and STOP. Never repair silently, never pick one arbitrarily.
|
|
39
|
+
|
|
40
|
+
## 2. Decide by command argument × state
|
|
41
|
+
|
|
42
|
+
- **Bare `/regent` + exactly one open activity** → resume it (sections 3–5).
|
|
43
|
+
- **Bare `/regent` + nothing open** → report state (last closed round/plan, build
|
|
44
|
+
candidates) and ask what to start. Never start anything implicitly.
|
|
45
|
+
- **`brainstorm "<question>"` / `plan "<goal>"` + nothing open** → create the next
|
|
46
|
+
`ROUND-NNN/` (with `QUESTION.md`) or `PLAN-NNN/` (with `REQUEST.md`), owner's words
|
|
47
|
+
verbatim, and proceed.
|
|
48
|
+
- **`build`** → requires a build candidate: exactly one → start/resume it; more than one →
|
|
49
|
+
demand explicit selection `/regent build PLAN-NNN`; none → error (never build without an
|
|
50
|
+
APPROVED plan).
|
|
51
|
+
- **Any mode argument + a DIFFERENT open activity** → error explaining the state. Never
|
|
52
|
+
ignore the argument silently; never create a second activity.
|
|
53
|
+
|
|
54
|
+
## 3. Brainstorm mode
|
|
55
|
+
|
|
56
|
+
Loop: owner asks → Claude responds → advisor opines (explicit CONCORDA/DISCORDA verdict) →
|
|
57
|
+
CONCORDA: Claude executes; DISCORDA: one rebuttal cycle; persistent divergence → the owner
|
|
58
|
+
arbitrates. Round content in the mediator's language (REQ-002).
|
|
59
|
+
|
|
60
|
+
Resume at the first missing artifact: `QUESTION.md` → `CLAUDE-RESPONSE.md` →
|
|
61
|
+
`ADVISOR-OPINION-1.md` → (if DISCORDA) `CLAUDE-REBUTTAL.md` → `ADVISOR-OPINION-2.md` →
|
|
62
|
+
`DECISION.md` (what was decided, who closed it, what was executed), then execute and make an
|
|
63
|
+
**operational commit** (regent-owned paths only). If resuming a suspended activity, read
|
|
64
|
+
`SUSPENSION.md` first, delete it after resuming.
|
|
65
|
+
|
|
66
|
+
## 4. Plan mode
|
|
67
|
+
|
|
68
|
+
A plan is a deliberated artifact, driven like a round:
|
|
69
|
+
1. `REQUEST.md` — the owner's goal, verbatim.
|
|
70
|
+
2. `PLAN.md` — goal, scope in/out, **numbered steps, each with an acceptance criterion and
|
|
71
|
+
an executable gate command**, risks. Content in the host's native language.
|
|
72
|
+
3. `ADVISOR-REVIEW-1.md` — advisor verdict; one rebuttal cycle (`CLAUDE-REBUTTAL.md` +
|
|
73
|
+
`ADVISOR-REVIEW-2.md`); persistent divergence → owner arbitrates.
|
|
74
|
+
4. `APPROVAL.md` — structured: `status: APPROVED | REJECTED | CANCELLED`, actor (consensus /
|
|
75
|
+
owner), date. Without APPROVED status the plan is not executable. The owner may cancel a
|
|
76
|
+
plan at any time (record status + reason).
|
|
77
|
+
|
|
78
|
+
## 5. Build mode — execute an APPROVED plan, step by step
|
|
79
|
+
|
|
80
|
+
**Baseline.** On build start write `build/BASELINE.md`: the base SHA (`git rev-parse HEAD`)
|
|
81
|
+
and the plan reference. The final review diff is exactly `BASE-SHA..HEAD`.
|
|
82
|
+
|
|
83
|
+
**Per step (in plan order):**
|
|
84
|
+
1. Worktree MUST be clean at step start; dirty → report and STOP (default-deny — never
|
|
85
|
+
absorb pre-existing user changes).
|
|
86
|
+
2. Implement the step.
|
|
87
|
+
3. Run the step's gate command for real; record its output. Red gate → fix and re-run, or
|
|
88
|
+
suspend; a red gate NEVER proceeds and NEVER commits.
|
|
89
|
+
4. Write `build/STEP-NN.md`: base SHA of the step, files touched, gate output. NO commit
|
|
90
|
+
hash inside (it cannot know it — see trailer below).
|
|
91
|
+
5. Commit deliberately: stage file-by-file ONLY the paths attributable to the step (+ the
|
|
92
|
+
step's regent artifacts), inspect the staged diff, fail without committing if anything
|
|
93
|
+
unattributable is staged. Commit message ends with trailer `Regent-Step: PLAN-NNN/STEP-NN`
|
|
94
|
+
— the artifact↔commit link is resolved via this trailer, never via a hash in the artifact.
|
|
95
|
+
|
|
96
|
+
**Resume phases** (check trailer in `git log`, then STEP file, then worktree — in that order):
|
|
97
|
+
- IMPLEMENTING (dirty worktree, no gate recorded) → re-run the gate before anything; never
|
|
98
|
+
trust unvalidated code.
|
|
99
|
+
- GATE-RED (red output recorded) → back to implementation.
|
|
100
|
+
- GATE-GREEN-UNCOMMITTED (STEP written, trailer absent) → re-verify gate, then commit.
|
|
101
|
+
Checking the trailer BEFORE committing prevents duplicate commits.
|
|
102
|
+
- COMMITTED (trailer present) → step closed; advance.
|
|
103
|
+
|
|
104
|
+
**Finish:** `build/ADVISOR-REVIEW.md` — advisor reviews the full `BASE-SHA..HEAD` diff
|
|
105
|
+
(verdict + findings). Then `build/CONCLUSION.md`, structured: `status: ACCEPTED |
|
|
106
|
+
ACCEPTED-WITH-RESERVATIONS | REJECTED`, actor, pending items. An adverse review or a
|
|
107
|
+
non-arbitrated divergence can NEVER become acceptance. Any post-review fix invalidates the
|
|
108
|
+
review: re-run the affected gate AND a new advisor consultation before concluding.
|
|
109
|
+
|
|
110
|
+
## 6. Advisor consultations (shared contract — REQ-003 §5)
|
|
111
|
+
|
|
112
|
+
Invocation (read-only, never writes, never holds the turn):
|
|
113
|
+
`codex --ask-for-approval never --sandbox read-only exec --cd <repo> -o <tmpfile> "<prompt>"`
|
|
114
|
+
|
|
115
|
+
Every consultation persists its full evidence tuple: the complete prompt in
|
|
116
|
+
`<ARTIFACT>-PROMPT.md` next to the response artifact, and the response artifact opening with
|
|
117
|
+
a structured header — `outcome: SUCCESS|TIMEOUT|FAILURE|CANCELLED`, `exit_code`,
|
|
118
|
+
`timestamp`, `linkage` (ROUND-NNN / PLAN-NNN[/build]). Fail-closed: a non-SUCCESS outcome
|
|
119
|
+
never advances the activity; retry means a NEW recorded consultation.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: regent-stop
|
|
3
|
+
description: Safely stop/suspend the regent activity in progress (brainstorm round, plan deliberation, or build) so it can be resumed later with /regent. Use when the owner says /regent-stop, "para", "suspende", or asks to stop regent work.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# /regent-stop — safe stop of the current activity
|
|
7
|
+
|
|
8
|
+
> **Capability level: v0 (file-driven).** There is no daemon, lock or in-flight abort yet:
|
|
9
|
+
> stopping means recording a durable suspension marker at the next message boundary. Do not
|
|
10
|
+
> claim atomic cancellation — immediate interruption of a running step is the user's Esc,
|
|
11
|
+
> not this command.
|
|
12
|
+
|
|
13
|
+
## Steps
|
|
14
|
+
|
|
15
|
+
1. Locate the state roots and the single open activity exactly as `/regent` does (its
|
|
16
|
+
sections 0–1: brainstorm round without DECISION, plan without APPROVAL, or build without
|
|
17
|
+
CONCLUSION; legacy PT scheme respected; ambiguity = report and stop, touch nothing).
|
|
18
|
+
Nothing open → report that the state is clean (nothing to stop) and stop.
|
|
19
|
+
2. Write `SUSPENSION.md` (legacy hosts: `SUSPENSAO.md`) inside the open activity dir with:
|
|
20
|
+
timestamp, reason given by the owner (ask if not stated), and the resume checkpoint —
|
|
21
|
+
for brainstorm/plan: which artifact was pending; for build: the current step and its
|
|
22
|
+
phase (IMPLEMENTING / GATE-RED / GATE-GREEN-UNCOMMITTED / COMMITTED) plus any in-flight
|
|
23
|
+
consultation outcome.
|
|
24
|
+
3. Persist everything already produced — never delete partial artifacts; they are evidence.
|
|
25
|
+
A build step in IMPLEMENTING phase keeps its uncommitted worktree changes untouched;
|
|
26
|
+
record in SUSPENSION.md that the worktree is intentionally dirty.
|
|
27
|
+
4. Make an operational commit of ONLY regent-owned paths (`.regent/`, the `.claude/` symlink
|
|
28
|
+
integrations, and — in the regent repo only — `docs/`). Never commit host code from here:
|
|
29
|
+
deliberate build-step commits belong to `/regent` (REQ-005). A failed commit does NOT
|
|
30
|
+
prevent the suspension — report it and leave the commit pending.
|
|
31
|
+
5. Confirm to the owner: what was suspended, at which checkpoint, and that `/regent`
|
|
32
|
+
resumes it.
|
|
@@ -31,7 +31,8 @@ class InitTest(unittest.TestCase):
|
|
|
31
31
|
self.assertTrue(link.is_symlink())
|
|
32
32
|
self.assertEqual(os.readlink(link), f"../../.regent/skills/{name}")
|
|
33
33
|
self.assertTrue((link / "SKILL.md").is_file()) # symlink resolves
|
|
34
|
-
self.assertTrue((self.root / ".regent" / "brainstorm" / "
|
|
34
|
+
self.assertTrue((self.root / ".regent" / "brainstorm" / "rounds").is_dir())
|
|
35
|
+
self.assertTrue((self.root / ".regent" / "plans").is_dir())
|
|
35
36
|
|
|
36
37
|
def test_rerun_is_noop(self):
|
|
37
38
|
self.assertEqual(self._init()[0], EXIT_OK)
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: regent
|
|
3
|
-
description: Start or resume the regent activity in this repo (brainstorm round, planning, implementation). Single state-driven entry point — detects what is open and drives the next step. Use when the owner says /regent, "retome o brainstorm", "próxima rodada", or asks to continue regent work.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# /regent — start or resume the current activity
|
|
7
|
-
|
|
8
|
-
> **Capability level: v0 (file-driven).** State detection is based on round files only.
|
|
9
|
-
> There is no `control.json`, no turn lock, no daemon, no atomic abort and no structured
|
|
10
|
-
> checkpoint yet — those arrive with REQ-004's full implementation. Do not claim
|
|
11
|
-
> capabilities beyond this file.
|
|
12
|
-
|
|
13
|
-
## 0. Locate the rounds directory (deterministic, never guess)
|
|
14
|
-
|
|
15
|
-
- Host projects: `ROUNDS = .regent/brainstorm/rodadas/` (created on first use).
|
|
16
|
-
- The regent product repo itself keeps its own deliberation in `docs/brainstorm/rodadas/`
|
|
17
|
-
(legacy dogfood location).
|
|
18
|
-
- Resolution: if `.regent/brainstorm/` exists use it; else if `docs/brainstorm/` exists use
|
|
19
|
-
that; if BOTH exist, report the ambiguity and STOP; if neither, this is a fresh host —
|
|
20
|
-
`ROUNDS = .regent/brainstorm/rodadas/`.
|
|
21
|
-
|
|
22
|
-
## 1. Detect state (never guess)
|
|
23
|
-
|
|
24
|
-
- Open round = a `ROUNDS/RODADA-NNN/` directory WITHOUT `DECISAO.md`.
|
|
25
|
-
- Suspended round = an open round containing `SUSPENSAO.md`.
|
|
26
|
-
- If the state is ambiguous or corrupted (two open rounds, missing PERGUNTA.md), REPORT the
|
|
27
|
-
anomaly and STOP. Default-deny: never repair silently, never pick one arbitrarily.
|
|
28
|
-
|
|
29
|
-
## 2. Decide by command argument × state
|
|
30
|
-
|
|
31
|
-
- **No argument + exactly one open/suspended round** → resume it (step 3).
|
|
32
|
-
- **No argument + nothing open** → report the state (last closed round, PRD requirement log)
|
|
33
|
-
and ask what to start. Never start anything implicitly.
|
|
34
|
-
- **`brainstorm "<question>"` + nothing open** → create the next `ROUNDS/RODADA-NNN/` with
|
|
35
|
-
`PERGUNTA.md` (owner's question verbatim) and proceed to step 3.
|
|
36
|
-
- **`brainstorm ...` + a DIFFERENT round already open** → error explaining the open state.
|
|
37
|
-
Never ignore the argument silently; never create a second activity.
|
|
38
|
-
- **`plan` / `build`** → not available at v0; say so explicitly and point to REQ-004.
|
|
39
|
-
|
|
40
|
-
## 3. Drive the round (the loop protocol is THIS section — self-contained)
|
|
41
|
-
|
|
42
|
-
Loop: owner asks → Claude responds → Codex (advisor) opines with an explicit
|
|
43
|
-
CONCORDA/DISCORDA verdict → if CONCORDA, Claude executes; if DISCORDA, one rebuttal cycle;
|
|
44
|
-
persistent divergence → the owner arbitrates. Round language: the mediator's (REQ-002).
|
|
45
|
-
|
|
46
|
-
Resume at the first missing artifact, in order:
|
|
47
|
-
1. `RESPOSTA-CLAUDE.md` — Claude's reasoned position + concrete proposal.
|
|
48
|
-
2. `OPINIAO-CODEX-1.md` — headless advisor consultation, saved verbatim:
|
|
49
|
-
`codex --ask-for-approval never --sandbox read-only exec --cd <repo> -o <tmpfile> "<prompt>"`
|
|
50
|
-
(prompt tells Codex which files to read and to end with a line containing only
|
|
51
|
-
CONCORDA or DISCORDA).
|
|
52
|
-
3. If DISCORDA → `REPLICA-CLAUDE.md` then `OPINIAO-CODEX-2.md` (one rebuttal cycle max).
|
|
53
|
-
4. Persistent divergence → the owner arbitrates (they are mediating live).
|
|
54
|
-
5. `DECISAO.md` — what was decided, who closed it, what was executed. Then execute it and
|
|
55
|
-
commit ONLY regent-owned paths (`.regent/`, the `.claude/` symlink integrations, and —
|
|
56
|
-
in the regent repo only — `docs/`) — never unrelated host content. A failed commit does
|
|
57
|
-
not undo the round; report it and leave it pending.
|
|
58
|
-
|
|
59
|
-
If resuming a suspended round, read `SUSPENSAO.md` first, delete it after resuming, and
|
|
60
|
-
continue from the recorded pending step.
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: regent-stop
|
|
3
|
-
description: Safely stop/suspend the regent activity in progress (brainstorm round, planning, implementation) so it can be resumed later with /regent. Use when the owner says /regent-stop, "para o brainstorm", "suspende a rodada", or asks to stop regent work.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# /regent-stop — safe stop of the current activity
|
|
7
|
-
|
|
8
|
-
> **Capability level: v0 (file-driven).** There is no daemon, lock or in-flight abort yet:
|
|
9
|
-
> stopping means recording a durable suspension marker at the next message boundary. Do not
|
|
10
|
-
> claim atomic cancellation — immediate interruption of a running step is the user's Esc,
|
|
11
|
-
> not this command.
|
|
12
|
-
|
|
13
|
-
## Steps
|
|
14
|
-
|
|
15
|
-
1. Locate the rounds directory exactly as `/regent` does (step 0 of its skill: host =
|
|
16
|
-
`.regent/brainstorm/rodadas/`; the regent repo itself = `docs/brainstorm/rodadas/`; both
|
|
17
|
-
present = ambiguity, stop). Then detect the open round: `RODADA-NNN/` without `DECISAO.md`.
|
|
18
|
-
- Nothing open → report that the state is clean (nothing to stop) and stop.
|
|
19
|
-
- Ambiguous state → report the anomaly; do not modify anything.
|
|
20
|
-
2. Write `SUSPENSAO.md` in the open round with: timestamp, reason given by the owner (ask if
|
|
21
|
-
not stated), which artifact/step was pending (the resume checkpoint), and any partial
|
|
22
|
-
output worth keeping (e.g. an advisor consultation already saved).
|
|
23
|
-
3. Persist everything already produced — never delete partial artifacts; they are evidence.
|
|
24
|
-
4. Commit ONLY regent-owned paths (`.regent/`, the `.claude/` symlink integrations, and —
|
|
25
|
-
in the regent repo only — `docs/`). A failed commit does NOT prevent the suspension —
|
|
26
|
-
report it and leave the commit pending.
|
|
27
|
-
5. Confirm to the owner: what was suspended, where it will resume from (`/regent`).
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|