@lazyingart/agintiflow 0.20.49 → 0.20.50

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.
@@ -0,0 +1,331 @@
1
+ # Student-Committee-Supervisor Mode
2
+
3
+ This note researches the current AgInTiFlow execution pipeline and proposes a standalone `/enabless` mode: Student-Committee-Supervisor, abbreviated `SCS`.
4
+
5
+ The name intentionally keeps the reversed-role joke: the "student" supervises, the "supervisor" executes, and the "committee" drafts but cannot decide.
6
+
7
+ ## Current Working Pipeline
8
+
9
+ The current AgInTiFlow runner is a single-executor agent loop with optional advisory scouts.
10
+
11
+ Current flow:
12
+
13
+ 1. CLI/web state chooses runtime settings: provider, routing mode, role models, task profile, shell/file/web/scout toggles, sandbox, and max steps.
14
+ 2. `resolveRuntimeConfig()` selects one effective provider/model for the run using `selectModelRoute()`. The route/main/spare role settings exist, but each run still has one active `config.provider` and `config.model`.
15
+ 3. `runAgent()` creates or resumes a central session store, creates an OpenAI-compatible client, loads project instructions, selected skills, profile prompts, engineering guidance, tool policy text, and the user goal into the model context.
16
+ 4. If the session has no plan, `createPlan()` asks the active run model to draft a concise 3-6 step plan. This plan is saved and rendered, but it is not independently approved.
17
+ 5. If the task is complex and scouts are enabled, `runParallelScouts()` builds a bounded context pack, runs several advisory scout calls, synthesizes a Swarm Board, saves `scout-blackboard.json`, and injects the summary as advisory user context.
18
+ 6. The executor loop starts. Each step drains queued user input, captures a browser or synthetic runtime snapshot, appends step state to the conversation, calls `requestNextStep()`, executes any returned tool calls, records events, saves state, and repeats.
19
+ 7. Tools are deterministic and policy-guarded: file tools, shell/Docker, tmux, web search, browser, wrapper delegation, image generation, canvas, and `finish`.
20
+ 8. Loop guards inject warnings when the same failed/blocked tool call repeats.
21
+ 9. The run ends when the model calls `finish`, returns assistant content without tools, hits max steps, or is interrupted.
22
+ 10. Housekeeping flushes after the run.
23
+
24
+ Important current properties:
25
+
26
+ - Planning and execution use the same active run model.
27
+ - Smart routing decides the active model before the run. It does not currently run planning on route and execution on main as separate inner roles.
28
+ - Parallel scouts are advisory only. They cannot approve, veto, pause, or request replanning.
29
+ - `/review` is implemented as a slash-command prompt wrapper that runs the normal executor in review profile with a bounded review prompt.
30
+ - Session events are already rich enough to support a monitor: `plan.created`, `parallel_scouts.completed`, `model.requested`, `model.responded`, `tool.started`, `tool.completed`, `tool.failed`, `tool.blocked`, `loop.guard`, `file.changed`, `session.finished`, and `session.stopped`.
31
+
32
+ Relevant implementation files:
33
+
34
+ - `src/config.js`: runtime config and role-model resolution.
35
+ - `src/model-routing.js`: smart/manual route selection and model catalogs.
36
+ - `src/model-client.js`: plan call, tool schema, text tool-call fallback, next-step request.
37
+ - `src/parallel-scouts.js`: advisory scout swarm and coordinator board.
38
+ - `src/agent-runner.js`: session lifecycle, plan creation, event loop, tool execution, queued input, finish behavior.
39
+ - `src/interactive-cli.js`: slash commands such as `/review`, `/route`, `/model`, `/scouts`, `/skillmesh`.
40
+
41
+ ## Proposed SCS Contract
42
+
43
+ `/enabless` enables a stricter internal workflow for the current interactive session.
44
+
45
+ Roles:
46
+
47
+ | Role | Model | Rights | No-rights boundary |
48
+ | --- | --- | --- | --- |
49
+ | Student | Main model | Monitor execution, approve plan, veto plan, request rethink based on evidence, decide whether enough work was done. | Does not execute tools directly. |
50
+ | Committee | Main model | Draft candidate plans and alternatives. | Cannot approve, veto, replan after execution starts, or call tools. |
51
+ | Supervisor | Main model | Execute the approved plan with the existing tool loop. | Cannot draft its own initial plan, cannot approve its own plan, cannot declare strategic replans without student permission. |
52
+
53
+ The user asked that once `/enabless` is enabled, all SCS work uses the main model. This is sensible for determinism: no route/main mismatch, no cheap planner producing a plan that a stronger executor dislikes, and no confusing cross-model responsibility. It also makes cost predictable because the feature is opt-in.
54
+
55
+ ## Pros
56
+
57
+ SCS improves AgInTiFlow in several ways.
58
+
59
+ - It separates plan quality from tool execution. The current executor can draft a plan then immediately execute it; SCS inserts a real gate.
60
+ - It makes the monitor role explicit. Existing scouts advise before execution, but they do not watch tool results or catch false completion.
61
+ - It turns repeated failure into controlled replanning. Current loop guards warn the executor; SCS lets a separate monitor decide that the current plan is bad.
62
+ - It improves long-running task discipline. A student monitor can check whether acceptance criteria are still aligned after each milestone.
63
+ - It creates a good path for self-supervision. The student role can later become a reusable quality gate across coding, Android, LaTeX, writing, GitHub, system maintenance, and design profiles.
64
+ - It maps well to existing event logs. The runner already records enough state for a monitor to summarize and judge without re-reading the whole transcript.
65
+ - It preserves the existing tool surface. The supervisor can be the same `requestNextStep()` executor with extra constraints.
66
+ - It fits mature agent patterns: Codex-style streaming events and review modes, Qwen-style permission callbacks and plan mode, Claude-style multi-agent review, and Gemini-style behavioral eval feedback.
67
+
68
+ ## Cons And Failure Modes
69
+
70
+ SCS also has real risks.
71
+
72
+ - It may slow simple tasks. Three internal roles are wasteful for `ls`, `pwd`, or a short answer.
73
+ - It can create circular authority. If the supervisor cannot propose replans but discovers new facts through tools, the student must translate those facts into a rethink request.
74
+ - It can overfit to plan approval. Many coding tasks need opportunistic discovery; the initial plan should be a phase plan, not a rigid contract.
75
+ - It can produce committee noise. A committee that only drafts plans can still waste tokens if asked too often or without a tight schema.
76
+ - It can reduce model diversity. Using only the main model avoids cross-model confusion but loses cheap scouts and independent failure modes.
77
+ - It can deadlock on veto. A bad student veto could block progress unless there is a bounded retry policy.
78
+ - It can hide accountability if events are not explicit. Every SCS decision must be logged as a typed event with evidence and role.
79
+ - It can degrade UX if the CLI prints every internal debate. Users should see compact state: `SCS plan approved`, `SCS rethink requested`, `SCS vetoed: reason`.
80
+
81
+ ## Recommended Mature Design
82
+
83
+ The strongest version is not a permanent three-agent debate. It is a gated phase controller with three role prompts and strict event contracts.
84
+
85
+ Use this model:
86
+
87
+ 1. Committee drafts candidate phase plans.
88
+ 2. Student selects, edits, approves, or vetoes one plan.
89
+ 3. Supervisor executes only the approved next phase.
90
+ 4. Student evaluates evidence after each phase or after a failure trigger.
91
+ 5. If accepted, continue to the next phase or finish.
92
+ 6. If rejected, student requests committee rethink with evidence.
93
+
94
+ The key change is "phase", not "whole task". The committee should draft the next 1-3 milestones, not a giant plan for the whole project. This matches the existing rolling autonomy roadmap and avoids brittle long lists.
95
+
96
+ Decision schema:
97
+
98
+ ```json
99
+ {
100
+ "role": "student",
101
+ "decision": "approve_plan | veto_plan | rethink_plan | accept_phase | reject_phase | finish_allowed",
102
+ "confidence": 0.0,
103
+ "evidence": ["event ids, file paths, command summaries, tool failures"],
104
+ "reason": "short concrete reason",
105
+ "next_required_action": "committee_rethink | supervisor_execute | supervisor_continue | finish"
106
+ }
107
+ ```
108
+
109
+ Committee schema:
110
+
111
+ ```json
112
+ {
113
+ "role": "committee",
114
+ "phase_goal": "one concrete milestone",
115
+ "plan": ["3-6 concrete steps"],
116
+ "acceptance_criteria": ["observable evidence"],
117
+ "allowed_tools": ["inspect_project", "search_files", "read_file", "apply_patch", "run_command"],
118
+ "stop_conditions": ["blocked dependency", "dirty unrelated files", "same failure twice"]
119
+ }
120
+ ```
121
+
122
+ Supervisor constraint:
123
+
124
+ ```text
125
+ Execute only the approved phase plan. You may choose exact tools and paths, but you may not invent a new strategic plan. If tool results invalidate the plan, report the evidence and stop for student review.
126
+ ```
127
+
128
+ ## Standalone Feature Architecture
129
+
130
+ Implement SCS as an optional orchestration layer around the existing runner, not as a rewrite of tools.
131
+
132
+ New config/state:
133
+
134
+ - `AGINTI_SCS_MODE=true`
135
+ - CLI flag: `--enable-scs`
136
+ - interactive command: `/enabless`, `/enabless off`, `/enabless status`
137
+ - state fields:
138
+ - `state.enableScs`
139
+ - `state.scs.phase`
140
+ - `state.scs.plan`
141
+ - `state.scs.studentDecision`
142
+ - `state.scs.history`
143
+
144
+ New module:
145
+
146
+ - `src/scs-controller.js`
147
+
148
+ Responsibilities:
149
+
150
+ - Build compact evidence packs from session state and recent events.
151
+ - Ask committee for a phase plan using the main model.
152
+ - Ask student to approve/veto/rethink using the main model.
153
+ - Inject the approved phase plan as a system/user constraint before supervisor execution.
154
+ - Decide when to pause execution and trigger student review.
155
+ - Persist typed SCS events.
156
+
157
+ Suggested events:
158
+
159
+ - `scs.enabled`
160
+ - `scs.committee.plan_drafted`
161
+ - `scs.student.plan_approved`
162
+ - `scs.student.plan_vetoed`
163
+ - `scs.student.rethink_requested`
164
+ - `scs.supervisor.phase_started`
165
+ - `scs.supervisor.phase_blocked`
166
+ - `scs.student.phase_accepted`
167
+ - `scs.student.phase_rejected`
168
+ - `scs.finished_allowed`
169
+
170
+ Execution hooks:
171
+
172
+ 1. Before `createPlan()`: if SCS is enabled, call committee planner instead of normal `createPlan()`.
173
+ 2. After committee plan: call student approval. If vetoed, retry committee with veto reason up to a small bound such as 2.
174
+ 3. Before each executor request: inject approved phase plan and supervisor constraints.
175
+ 4. After each tool failure/block, repeated loop guard, file change batch, or N steps: call student monitor.
176
+ 5. Before `finish`: require student `finish_allowed` unless the run is stopped by user/max steps.
177
+
178
+ This preserves current tool execution while adding a decision layer.
179
+
180
+ ## Trigger Policy
181
+
182
+ Do not run SCS on every task unless the user explicitly enables it.
183
+
184
+ Recommended modes:
185
+
186
+ | Mode | Behavior |
187
+ | --- | --- |
188
+ | `off` | Current behavior. |
189
+ | `on` | SCS gates all non-trivial work in the session. |
190
+ | `auto` | SCS only activates for complex tasks, write actions, multi-step shell work, GitHub, system maintenance, Android/iOS, LaTeX/PDF, and long-running tasks. |
191
+
192
+ `/enabless` should toggle `on` in interactive CLI for the joke and speed. `/enabless auto` can be the mature default later.
193
+
194
+ ## Model Policy
195
+
196
+ When SCS is enabled:
197
+
198
+ - Use `mainProvider/mainModel` for committee, student, and supervisor.
199
+ - Set `config.provider/model` to the main role for the run.
200
+ - Keep the spare model disabled unless the user explicitly asks for external critique.
201
+ - Keep parallel scouts disabled by default inside SCS to avoid duplicated advisory layers.
202
+
203
+ Reasoning:
204
+
205
+ - The committee and student need enough ability to evaluate plans and evidence.
206
+ - Route model savings are less important because SCS is opt-in for quality.
207
+ - One model family avoids conflicts from tool-call quirks across providers.
208
+
209
+ Possible future improvement:
210
+
211
+ - `SCS auto` may use cheap route model for committee drafts, main model for student approval, and main model for supervisor execution. That should be added only after the one-main-model version is reliable.
212
+
213
+ ## UI And CLI
214
+
215
+ CLI:
216
+
217
+ ```text
218
+ /enabless
219
+ /enabless off
220
+ /enabless auto
221
+ /enabless status
222
+ ```
223
+
224
+ Status output:
225
+
226
+ ```text
227
+ scs=on model=deepseek/deepseek-v4-pro phase=2 decision=phase_accepted
228
+ ```
229
+
230
+ During a run, keep output compact:
231
+
232
+ ```text
233
+ scs committee drafted phase plan
234
+ scs student approved plan confidence=0.82
235
+ scs student requested rethink: repeated blocked write_file
236
+ ```
237
+
238
+ Web:
239
+
240
+ - Add SCS toggle under Advanced settings first.
241
+ - Show a compact SCS timeline near runtime logs.
242
+ - Do not show raw committee/student transcripts by default; expose them in events/artifacts for inspection.
243
+
244
+ ## Safety And Performance
245
+
246
+ Bounds:
247
+
248
+ - Committee plan retries: max 2.
249
+ - Student monitor calls: after plan, before finish, and on triggers; not after every successful tool by default.
250
+ - Evidence pack: last 20 events plus current plan, changed files, tool failures, and acceptance criteria.
251
+ - Transcript budget: summarize old SCS decisions; never append all committee text forever.
252
+ - Failure fallback: if SCS monitor errors, either fail closed for write/system tasks or fail open for read-only tasks with a warning event.
253
+
254
+ Security:
255
+
256
+ - Redact tool args with existing redaction helpers.
257
+ - Do not expose secrets in evidence packs.
258
+ - Do not let committee/student call tools.
259
+ - Do not let student approve command-policy violations. Existing guardrails remain authoritative.
260
+
261
+ ## How This Improves AgInTiFlow Beyond The Original Idea
262
+
263
+ The original idea defines role rights. The more mature design defines event rights.
264
+
265
+ Better principle:
266
+
267
+ > No internal role should have abstract authority. It should have permission to emit a small set of typed decisions, and the runtime decides what those decisions can do.
268
+
269
+ This keeps the system inspectable, testable, and easier to debug.
270
+
271
+ Recommended mature shape:
272
+
273
+ - `committee`: proposes structured phase plans.
274
+ - `student`: emits typed gates based on evidence.
275
+ - `supervisor`: executes existing tools under an approved phase.
276
+ - `runtime`: remains the real authority for guardrails, filesystem safety, command policy, session persistence, and user interruption.
277
+
278
+ This is stronger than a pure multi-agent conversation because it turns role behavior into product behavior.
279
+
280
+ ## Implementation Plan
281
+
282
+ Implemented first slice:
283
+
284
+ - `src/scs-controller.js` provides mode normalization, auto activation, committee/student JSON calls, evidence packs, supervisor instructions, tool-failure monitoring, periodic progress review, and final finish gates.
285
+ - `src/config.js` adds `enableScs`/`scsActive` and switches active execution to the main model role when SCS is active.
286
+ - `src/interactive-cli.js` adds `/enabless`, `/enabless auto`, `/enabless off`, `/enabless status`, and `/scs` alias.
287
+ - `src/cli.js` adds `--enabless`, `--enabless auto`, `--no-enabless`, and aliases.
288
+ - `src/agent-runner.js` persists typed `scs.*` events, saves `scs-phase-001.json`, injects the approved supervisor phase, reviews failed tools, and gates finish.
289
+
290
+ Remaining roadmap:
291
+
292
+ Phase 1: documentation and config
293
+
294
+ - Status: implemented for CLI and config.
295
+
296
+ Phase 2: plan gate
297
+
298
+ - Status: implemented for the initial phase gate.
299
+
300
+ Phase 3: execution monitor
301
+
302
+ - Status: implemented for failed/blocked tools, every-four-steps progress review, and finish gate.
303
+
304
+ Phase 4: web and tests
305
+
306
+ - Add web toggle and SCS timeline.
307
+ - Add mock-mode smoke tests for approve, veto, rethink, and finish gate.
308
+ - Add a regression case where the executor tries to finish after a failed tool and student rejects it.
309
+
310
+ Phase 5: auto mode
311
+
312
+ - Enable SCS automatically for complex risky profiles after behavior is stable.
313
+ - Keep simple tasks on the current fast pipeline.
314
+
315
+ ## Open Questions
316
+
317
+ - Should SCS approval be required before any write tool, or only before the first phase starts?
318
+ - Should the student be allowed to require specific checks, or only accept/reject evidence?
319
+ - Should committee be one call or multiple candidate calls synthesized into one plan?
320
+ - Should `/enabless` be hidden as a playful alias while `/scs` is the serious public command?
321
+ - Should SCS decisions be shared through Skill Mesh as learned supervision skills?
322
+
323
+ ## Recommendation
324
+
325
+ Implement `/enabless` as a serious opt-in quality mode with a playful name.
326
+
327
+ Start with one-main-model SCS and only gate the initial plan plus final finish. Then add failure-triggered student monitoring. Avoid per-tool approval in the first version; existing command and file guardrails already protect the dangerous paths, and too many monitor calls will make the product feel slow.
328
+
329
+ The most valuable first success criterion is this:
330
+
331
+ > In a complex coding task, AgInTiFlow should not execute a weak initial plan, should not keep repeating a failed action, and should not claim completion until a separate monitor has seen evidence.
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env node
2
+ import fs from "node:fs/promises";
3
+ import os from "node:os";
4
+ import path from "node:path";
5
+ import { fileURLToPath } from "node:url";
6
+ import { aapsStatus, discoverAaps, formatAapsResult, runAapsAction } from "../src/aaps-adapter.js";
7
+
8
+ const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
9
+ const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "agintiflow-aaps-adapter-"));
10
+
11
+ function assert(condition, message) {
12
+ if (!condition) throw new Error(message);
13
+ }
14
+
15
+ async function exists(file) {
16
+ try {
17
+ await fs.access(file);
18
+ return true;
19
+ } catch {
20
+ return false;
21
+ }
22
+ }
23
+
24
+ const init = await runAapsAction("init", ["Smoke AAPS Project"], { cwd: tempRoot, packageDir: repoRoot });
25
+ assert(init.ok, "AAPS init failed");
26
+ assert(await exists(path.join(tempRoot, "aaps.project.json")), "AAPS init did not write manifest");
27
+ assert(await exists(path.join(tempRoot, "workflows", "main.aaps")), "AAPS init did not write starter workflow");
28
+
29
+ const files = await runAapsAction("files", [], { cwd: tempRoot, packageDir: repoRoot });
30
+ assert(files.ok && files.files.includes("workflows/main.aaps"), "AAPS files did not find starter workflow");
31
+
32
+ const status = await aapsStatus({ cwd: tempRoot, packageDir: repoRoot });
33
+ assert(status.ok && status.manifest?.activeFile === "workflows/main.aaps", "AAPS status did not read manifest");
34
+ assert(formatAapsResult(status).includes("AAPS adapter:"), "AAPS status formatter failed");
35
+
36
+ const discovery = await discoverAaps({ cwd: tempRoot, packageDir: repoRoot });
37
+ if (discovery.found) {
38
+ const validate = await runAapsAction("validate", [], { cwd: tempRoot, packageDir: repoRoot });
39
+ assert(validate.ok && validate.json?.ok === true, `AAPS validate failed\n${formatAapsResult(validate)}`);
40
+
41
+ const parse = await runAapsAction("parse", [], { cwd: tempRoot, packageDir: repoRoot });
42
+ assert(parse.ok && parse.json?.pipeline?.name?.includes("Smoke AAPS Project"), `AAPS parse failed\n${formatAapsResult(parse)}`);
43
+
44
+ const compile = await runAapsAction("compile", ["check"], { cwd: tempRoot, packageDir: repoRoot });
45
+ assert(compile.json?.phase?.parse === "ok", `AAPS compile check did not return a structured parse-ok report\n${formatAapsResult(compile)}`);
46
+ assert(
47
+ compile.json?.status === "missing_components" || compile.json?.ok === true,
48
+ `AAPS compile check returned an unexpected status\n${formatAapsResult(compile)}`
49
+ );
50
+ } else {
51
+ const validate = await runAapsAction("validate", [], { cwd: tempRoot, packageDir: repoRoot });
52
+ assert(validate.ok === false && validate.error, "AAPS missing path should return a structured error");
53
+ }
54
+
55
+ console.log(
56
+ JSON.stringify(
57
+ {
58
+ ok: true,
59
+ tempRoot,
60
+ realAaps: discovery.found,
61
+ source: discovery.source || "",
62
+ checks: ["init", "files", "status", discovery.found ? "validate/parse/compile" : "missing-error"],
63
+ },
64
+ null,
65
+ 2
66
+ )
67
+ );
@@ -7,6 +7,8 @@ triggers:
7
7
  - .aaps
8
8
  - @lazyingart/aaps
9
9
  - automation plan
10
+ - pipeline script
11
+ - large workflow
10
12
  tools:
11
13
  - inspect_project
12
14
  - read_file
@@ -16,6 +18,25 @@ tools:
16
18
  ---
17
19
  # AAPS Workflows
18
20
 
19
- Inspect nearby `.aaps` files, package docs, and project notes before generating workflows. Keep assumptions explicit and outputs project-local.
21
+ Use AAPS when the user wants a large workflow, autonomous pipeline script, `.aaps` file, or `@lazyingart/aaps` project.
20
22
 
21
- Do not publish, upload, or expose credentials unless explicitly requested and safe.
23
+ ## Operating Loop
24
+
25
+ 1. Inspect `aaps.project.json`, `workflows/*.aaps`, and nearby project notes before generating workflows.
26
+ 2. Prefer the AgInTiFlow adapter commands before raw shell guesses:
27
+ - `/aaps status` or `aginti aaps status`
28
+ - `/aaps init` or `aginti aaps init`
29
+ - `/aaps files`
30
+ - `/aaps validate [file]`
31
+ - `/aaps parse [file]`
32
+ - `/aaps compile [file] check`
33
+ - `/aaps check [file]` or `/aaps dry-run [file]`
34
+ 3. Keep all paths project-relative. Do not reference absolute local paths inside reusable `.aaps` files.
35
+ 4. Use AAPS for top-down workflow contracts, agent/tool manifests, validation/recovery/review steps, and durable artifacts. Use normal AgInTiFlow file/shell tools for local implementation work under those contracts.
36
+ 5. Validate or compile-check every new or edited `.aaps` workflow before reporting it is ready.
37
+
38
+ ## Safety
39
+
40
+ Do not publish, upload, run destructive commands, or expose credentials unless explicitly requested and safe.
41
+
42
+ If AAPS is missing, suggest `/aaps install`, `aginti aaps install`, `npm install -g @lazyingart/aaps`, or setting `AAPS_BIN`.