jules-orchestrator-kit 0.39.0 → 0.41.1

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.
@@ -1,18 +1,21 @@
1
1
  # Bolt - Performance & Payload Optimization Specialist ⚡
2
2
 
3
3
  > **Role:** Codebase Micro-Optimizer & Payload Governor.
4
- > **Scope:** Performance tuning, bundle size reduction, and asset optimization with zero structural side-effects.
4
+ > **Scope:** Performance tuning, artifact size reduction, and asset optimization with zero structural side-effects.
5
5
 
6
6
  ## Core Directives
7
7
 
8
8
  1. **Payload Budgeting:**
9
- - Keep total diff payload strictly under 75 KB (`git diff | wc -c`).
10
- - Eliminate redundant dependencies by replacing 3rd-party modules with Node.js built-ins (`node:fs`, `node:path`, `node:crypto`).
9
+ - Keep total diff payload strictly under {{DIFF_KB}} KB (`git diff | wc -c`).
10
+ - Prefer this project's existing dependencies and its language's standard library over adding another third-party module. Removing a dependency whose job the standard library already does is in scope; adding one is not.
11
11
 
12
12
  2. **Asset & Memory Optimization:**
13
- - Replace heavy raster assets with modern WebP/AVIF equivalents or clean SVGs.
14
- - Optimize hot execution paths: remove redundant object allocations inside tight loops.
13
+ - Replace heavy raster assets with modern equivalents (WebP/AVIF) or clean vector graphics, where the project already serves such formats.
14
+ - Optimize hot execution paths: remove redundant allocations inside tight loops, and hoist work out of repeated calls.
15
15
 
16
- 3. **Zero Regressions Invariant:**
17
- - Execute test suite (`npm test`) before and after every micro-optimization pass.
16
+ 3. **Evidence Before Claims:**
17
+ - A performance change requires numbers. Run the benchmark or timing measurement multiple times, compare medians, and state the delta. "Feels faster" is not a result, and a change below the noise floor is not an improvement.
18
+
19
+ 4. **Zero Regressions Invariant:**
20
+ - Execute `{{VERIFY_TEST}}` before and after every optimization pass, and record both results.
18
21
  - Never disable type-checks, skip tests, or alter public API signatures.
@@ -1,11 +1,11 @@
1
1
  # Janitor Protocol: Technical Debt & Dead Code Elimination
2
2
 
3
- You are **Janitor**, a specialist autonomous agent optimized for technical debt elimination, dead code pruning, and strict zero-dependency refactoring.
3
+ You are **Janitor**, a specialist autonomous agent optimized for technical debt elimination, dead code pruning, and conservative refactoring.
4
4
 
5
5
  ## Strict Operational Invariants
6
6
 
7
- 1. **Zero External Runtime Dependencies**: You are STRICTLY FORBIDDEN from adding third-party npm packages. Use ONLY native Node.js ESM built-in modules (`node:fs`, `node:path`, `node:crypto`, `node:child_process`, `node:os`).
8
- 2. **Dead Code Elimination**: Prune unused variables, unreachable branches, and redundant helper functions.
9
- 3. **Atomic Payload Limit**: Keep total patch payload under 75 KB (`git diff | wc -c`).
10
- 4. **Verification Requirement**: Execute `npm test` and `npm run lint` to ensure 100% of tests pass with 0 lint errors before completing work.
11
- 5. **No Assert Weakening**: Never weak or remove test assertions to make a test pass.
7
+ 1. **No New Dependencies**: Do NOT add third-party packages, libraries, or modules of any kind. Solve the task with this project's existing dependencies and its language's standard library. If a task genuinely cannot be completed without a new dependency, stop and say so instead of adding one.
8
+ 2. **Dead Code Elimination**: Prune unused variables, unreachable branches, and redundant helper functions. Confirm a symbol has no remaining references across the whole repository before removing it — including dynamic lookups, reflection, and string-keyed access, which a definition-search will not find.
9
+ 3. **Atomic Payload Limit**: Keep total patch payload under {{DIFF_KB}} KB (`git diff | wc -c`).
10
+ 4. **Verification Requirement**: Execute `{{VERIFY_TEST}}` and `{{VERIFY_LINT}}` and ensure 100% of tests pass with 0 lint errors before completing work.
11
+ 5. **No Assert Weakening**: Never weaken or remove test assertions to make a test pass. Leave an unmet requirement RED with a written rationale.
@@ -8,18 +8,19 @@
8
8
  ## Context
9
9
  - **Project Goals:** [Describe key architectural or business goals.]
10
10
  - **Key Files & Folders:** [List critical files, directories, or schemas, e.g. `src/auth.ts`, `schema.sql`.]
11
- - **Tech Stack:** [List frameworks and libraries, e.g. Node.js, Express, TypeScript, Drizzle ORM.]
11
+ - **Tech Stack:** [List this project's languages, frameworks, and libraries.]
12
12
 
13
13
  ## Requirements & Hard Constraints
14
14
  - **Functional Requirements:** [List specific, non-negotiable functional requirements.]
15
15
  - **Hard Constraints:**
16
- - Do NOT introduce third-party npm dependencies without explicit authorization.
17
- - Do NOT modify command files (`package.json`, `.github/`) or Agent Scope files.
18
- - Keep total diff payload strictly under 75 KB (`git diff | wc -c`).
16
+ - Do NOT introduce new third-party dependencies without explicit authorization.
17
+ - Do NOT modify this project's build manifest, lockfile, CI configuration, or agent scope files. Run `agentctl gate` to see the enforced set.
18
+ - Keep total diff payload strictly under {{DIFF_KB}} KB (`git diff | wc -c`).
19
19
 
20
20
  ## Verification Loop
21
- - **Verification Command:** Execute automated verification tests: `npm test`.
21
+ - **Verification Command:** Execute `{{VERIFY_TEST}}`.
22
22
  - **Zero Errors Invariant:** Ensure 100% of tests pass cleanly with 0 errors before submitting.
23
+ - **Carry the Evidence:** Paste the actual terminal output. Exit code 0 proves the process survived, not that the change works.
23
24
 
24
25
  ## Expected Artifacts
25
26
  - **Code Changes:** Clean, production-grade implementation preserving existing symbol contracts.
@@ -80,8 +80,8 @@ Jules automatically infers test and build verification commands via `scripts/com
80
80
 
81
81
  ## 6. Local CI Verification with Nektos Act
82
82
 
83
- - **Pre-Push CI Validation**: When `.github/workflows/` exists and Nektos `act` is installed, execute `act push` or `bash scripts/act/run-act.sh` to verify changes pass CI locally inside the VM before opening a PR.
84
- - **Log Inspection**: If local `act` CI fails, inspect `act_output.log`, resolve errors in code, and re-run verification before pushing.
83
+ - **Pre-Push CI Validation**: When `.github/workflows/` exists and Nektos `act` is installed, execute `act push` to verify changes pass CI locally inside the VM before opening a PR. Skip this step if `act` is not on `PATH` — do not install it and do not invent a wrapper script for it.
84
+ - **Log Inspection**: If local `act` CI fails, inspect its output, resolve errors in code, and re-run verification before pushing.
85
85
  - **Diff Payload Governor**: API forcefully truncates diff payloads > 80 KB. Keep total diff payload under 75 KB (`git diff | wc -c`).
86
86
 
87
87
  ---
@@ -101,7 +101,11 @@ To maximize the ratio of mergeable PRs vs. failed or hallucinated sessions, adhe
101
101
 
102
102
  ### Standard Jules Guardrails Footer
103
103
 
104
- Append this footer to all Jules dispatches:
104
+ `agentctl task create` appends this automatically, generated from your own
105
+ `.agent/config.yml` scope — so the protected-path line lists *your* build
106
+ manifests (`Cargo.toml`, `go.mod`, `pyproject.toml`, `composer.json`, …) and
107
+ rebases onto *your* base branch. Fill the placeholders only for hand-written
108
+ dispatches; run `agentctl gate` to see the full enforced set.
105
109
 
106
110
  ```text
107
111
  Read AGENTS.md and .agent/rules/jules-protocol.md BEFORE starting.
@@ -110,12 +114,12 @@ Follow all rules strictly.
110
114
  TASK: <description>
111
115
 
112
116
  HARD CONSTRAINTS:
113
- - Do NOT modify package.json, pnpm-lock.yaml, tsconfig.json, or .github/ files. Enforced in CI by Agent Scope Guard.
117
+ - Do NOT modify these protected paths: <your build manifest, lockfile, CI directory, and agent rules>.
114
118
  - Diff Payload Governor: Keep total diff payload under 75 KB (`git diff | wc -c`) to prevent API truncation (~80 KB limit).
115
119
  - Falsifiable & Evidence-Based: Attach full terminal verification output to PR. Never weaken assertions or delete failing tests to force a pass.
116
120
  - Declare Scope Deviations: If modifying files outside task bounds, explicitly state rationale in PR.
117
- - Verify before finishing: Run full type-check, lint, and unit test suites.
118
- - BEFORE opening the PR: Run `git fetch origin main && git rebase origin/main`, then re-verify. If the rebase leaves an empty diff, the work already landed — do NOT submit.
119
- - Delete ALL temporary files (.py, .sh, .patch, debug logs) before submitting.
121
+ - Verify before finishing: Run the project's full type-check, lint, and test commands.
122
+ - BEFORE opening the PR: Run `git fetch origin <base> && git rebase origin/<base>`, then re-verify. If the rebase leaves an empty diff, the work already landed — do NOT submit.
123
+ - Remove any scratch files you created for debugging before submitting. Do not delete files that are part of the project.
120
124
  ```
121
125
 
package/README.md CHANGED
@@ -51,16 +51,28 @@
51
51
  Get running in any repository in 3 commands (zero configuration required):
52
52
 
53
53
  ```bash
54
- # 1. Initialize orchestrator in your project (auto-detects Python, Rust, Go, Node, PHP, etc.)
54
+ # 1. Scaffold config, AGENTS.md, role prompts and guardrails
55
+ # (auto-detects Python, Rust, Go, Node, PHP, etc.)
55
56
  npx jules-orchestrator-kit init
57
+ ```
56
58
 
57
- # 2. Author a scoped, verified task envelope with guardrails & secret scrubbing
58
- npx jules-orchestrator-kit task create
59
+ ```bash
60
+ # 2. Commit what init wrote — .agent/config.yml is on the gate's deny list by
61
+ # design, so leaving it uncommitted makes the first gate reject your tree
62
+ git add .agent AGENTS.md .gitignore && git commit -m "chore: add agent config"
63
+ ```
59
64
 
60
- # 3. Inspect repository health & diagnostic status
61
- npx jules-orchestrator-kit doctor
65
+ ```bash
66
+ # 3. Author a scoped, verified task envelope with guardrails & secret scrubbing
67
+ npx jules-orchestrator-kit task create
62
68
  ```
63
69
 
70
+ > [!TIP]
71
+ > **Not sure what to run next?**
72
+ > `agentctl` with no arguments reads the repository state and prints the single
73
+ > next step — missing git repo, missing API key, empty queue, tasks ready to
74
+ > dispatch — instead of a wall of commands.
75
+
64
76
  > [!TIP]
65
77
  > **Prefer a global CLI?**
66
78
  > Install globally to access `agentctl` directly:
@@ -129,9 +141,9 @@ To maximize PR merge rates, dispatch tasks according to deterministic boundaries
129
141
  * **Cross-Platform Parity:** Verified 100% green across Linux, macOS (Darwin), and Windows on Node 20, 22, and 24.
130
142
  * **Autonomous Self-Healing Loop:** Captures test stderr/stdout, fingerprints error traces, and feeds structured context back into automated repair turns (up to 3 attempts) before human escalation.
131
143
  * **Fail-Closed Security & Secret Redaction:** Evaluates explicit Deny rules before Allow rules against canonicalized, case-folded paths. Redacts high-entropy keys and base64-encoded credentials (such as Kubernetes `Secret` manifests).
132
- * **Complexity & Cost Router:** Zero-dependency heuristic classifier (`src/router.mjs`) routing mechanical tasks to lightweight models while reserving primary models for complex refactors.
144
+ * **Complexity & Cost Router:** Zero-dependency heuristic classifier (`src/router.mjs`) routing mechanical tasks to lightweight models while reserving primary models for complex refactors, with a `node --check` syntax-verification gate that transparently escalates a FAST-tier result to the primary provider if it left broken JS on disk.
133
145
  * **Terminal UI & Diagnostic Matrix (`agentctl doctor`):** Interactive terminal dashboard, task sidecar manager, and automated transactional self-repair.
134
- * **Verified Test Suite:** Tested with **602 unit tests across 83 suites passing in < 10.0s**.
146
+ * **Verified Test Suite:** Tested with **706 unit tests across 85 suites passing in < 10.0s**.
135
147
 
136
148
  <br/>
137
149
 
@@ -146,17 +158,18 @@ To maximize PR merge rates, dispatch tasks according to deterministic boundaries
146
158
 
147
159
  | Command | Usage | Description | Exit Codes |
148
160
  | :--- | :--- | :--- | :--- |
149
- | `init` | `agentctl init [--interactive] [--tier pro]` | Interactive onboarding wizard & stack detector generating `.agent/config.yml`. | `0` (Created) |
150
- | `task create` | `agentctl task create [--title <t>] [--prompt <p>] [--template <id>] [--role <name>] [--tier fast\|complex]` | Interactively authors & scopes falsifiable task envelopes with secret scrubbing, preflight gate checks, and DAG dependency wiring. | `0` (Queued), `1` (Secret/Unfalsifiable) |
151
- | `task template` | `agentctl task template [<id>] [--list] [--json]` | Lists and synthesizes pre-calibrated task envelopes (Web & Agent Hardening: `web-cwv`, `web-wcag`, `web-seo`, `web-playwright`, `agent-dead-code-audit`, `web-flaky-heal`, `web-i18n`, `web-ai-access`, `agent-qa-mutation`, `agent-ci-falsify`, `agent-service-isolate`, `agent-error-paths`, `agent-security-audit`). | `0` (Listed/Synthesized) |
152
- | `dispatch` | `agentctl dispatch [-p <prompt>] [-f <file>] [-r <role>] [-t <tier>] [--check-premise] [--auto-pr] [--repoless] [--dry-run]` | Dispatches autonomous task to the active provider with pre-flight idempotency checks, payload limits, and role prompt resolution. | `0` (Dispatched), `1` (Error) |
161
+ | `init` | `agentctl init [--interactive] [--tier pro] [--force]` | Interactive onboarding wizard & stack detector. Generates `.agent/config.yml` and scaffolds `AGENTS.md`, the role prompts, the guardrails and the runtime `.gitignore` entries. Existing files are preserved unless `--force`. | `0` (Created) |
162
+ | `budget` | `agentctl budget [--by-user] [--json] [reset]` | Reports rolling 24h task budget, quota headroom, and per-developer task attribution without external auth servers. | `0` (Status), `2` (Arg Error) |
163
+ | `task create` | `agentctl task create [<prompt>] [--title <t>] [-p <prompt>] [-f <file>] [--template <id>] [--role <name>] [--tier fast\|complex]` | Interactively authors & scopes falsifiable task envelopes with secret scrubbing, preflight gate checks, and DAG dependency wiring. | `0` (Queued), `1` (Secret/Unfalsifiable) |
164
+ | `task template` | `agentctl task template [<id>] [--list] [--json]` | Lists and synthesizes pre-calibrated task envelopes (Web, Deep Think & Agent Hardening: `web-cwv`, `web-wcag`, `web-seo`, `web-playwright`, `agent-dead-code-audit`, `web-flaky-heal`, `web-i18n`, `web-ai-access`, `agent-qa-mutation`, `agent-ci-falsify`, `agent-service-isolate`, `agent-error-paths`, `agent-security-audit`, `deep-debug`, `deep-feature`, `deep-optimize`, `deep-harden`). | `0` (Listed/Synthesized) |
165
+ | `dispatch` | `agentctl dispatch [<prompt>] [-p <prompt>] [-f <file>] [-r <role>] [-t <tier>] [--author <name>] [--check-premise] [--auto-pr] [--repoless] [--dry-run]` | Dispatches autonomous task to the active provider with pre-flight idempotency checks, payload limits, and role prompt resolution. `--dry-run` stops short of the provider call and reports itself as a rehearsal rather than a dispatch. | `0` (Dispatched), `1` (Error) |
153
166
  | `plan approve` | `agentctl plan approve <sessionId> [--dry-run] [--json]` | Approves pending execution plan for an active Jules session (`:approvePlan`) with automatic 404/503 retry backoff. | `0` (Approved), `1` (Error) |
154
167
  | `session get` | `agentctl session get <sessionId> [--dry-run] [--json]` | Retrieves live session lifecycle state from provider REST API with token rotation. | `0` (Fetched), `1` (Error) |
155
- | `pr harvest` | `agentctl pr harvest [--tier r0,r1] [--limit <n>] [--auto] [--dry-run]` | Discovers open agent PRs, evaluates CI checks & risk tiers, and auto-squashes green low-risk changes autonomously. | `0` (Triaged/Merged), `1` (Error) |
168
+ | `pr harvest` | `agentctl pr harvest [--tier r0,r1] [--limit <n>] [--auto] [--allow-no-checks] [--dry-run]` | Discovers open agent PRs, evaluates CI checks & risk tiers, and auto-squashes green low-risk changes autonomously. A PR reporting **no** CI checks is skipped unless `--allow-no-checks` is passed, and an unavailable changed-file list blocks rather than classifying as low risk. | `0` (Triaged/Merged), `1` (Error) |
156
169
  | `doctor` | `agentctl doctor [--json]` | Diagnostic DAG check runner & automated transactional self-repair engine. | `0` (Healthy), `1` (Failures) |
157
170
  | `queue` | `agentctl queue [--dag] [--concurrency <n>] [--dry-run] [--json]` | Consumes and executes task envelopes in `.agent/jules-queue/` with Kahn's DAG dependency resolution. Non-task files (manifests, `README.md`) are skipped, and `--dry-run` previews without moving anything. | `0` (Complete) |
158
171
  | `swarm` | `agentctl swarm [--json]` | Runs parallel multi-agent swarm across worker slots with PID liveness detection. | `0` (Complete) |
159
- | `gate` / `audit`| `agentctl gate --mode working-tree [--json] [--json-report <path>]` | Runs security, secret scanning, and tiered verification gates (with declarative assertion support) against working tree or branch. | `0` (Approved), `3` (Scope), `5` (Diff >75K), `6` (Secret) |
172
+ | `gate` / `audit`| `agentctl gate --mode working-tree [--fix] [--json] [--json-report <path>]` | Runs security, secret scanning, and tiered verification gates (with declarative assertion support) against working tree or branch. Secret findings name the file and line; a failed verify stage reports its command, exit code and output. | `0` (Approved), `3` (Scope), `4` (Verify), `5` (Diff >75K), `6` (Secret), `8` (Flaky) |
160
173
  | `assert` | `agentctl assert [--dir <d>] [--file <f>] [--max-mb <n>] [--gzip] [--targets <g>] [--patterns <p>] [--json] [--json-report <p>]` | Runs declarative zero-dependency verification assertion primitives (`assert:dir-size`, `assert:file-size`, `assert:file-patterns`, `assert:exists`). | `0` (Passed), `1` (Assertion Failed) |
161
174
  | `rollback` | `agentctl rollback [sessionId \| --latest]` | Restores exact commit, uncommitted files, and cleans orphan task worktrees from pre-flight checkpoints. | `0` (Restored), `1` (Error) |
162
175
  | `resume` | `agentctl resume <sessionId> --response "<reply>"` | Streams engineer response back into active Google Jules warm session context window. | `0` (Resumed), `1` (Error) |
@@ -203,13 +216,28 @@ scope:
203
216
  - ".agent/config.yml"
204
217
  - "keys/**"
205
218
 
206
- # Operational limits & governors
219
+ # Plan tier. Defaults to `free` when unset — the kit will not assume you are
220
+ # paying for a larger plan than you are. Set this to unlock your real limits.
221
+ tier: "free" # free | pro | ultra
222
+
223
+ # Risk model for auto-merge triage. Builtin patterns cover what is dangerous in
224
+ # any repository (CI, lockfiles, migrations, key material, IaC, auth). Add the
225
+ # paths that are sensitive to YOUR domain — these EXTEND the builtins.
226
+ risk:
227
+ restricted: # R3 — never auto-merged
228
+ - "**/pricing/**"
229
+ - "**/billing/**"
230
+ consequential: # R2 — always requires a human read
231
+ - "packages/api/**"
232
+ max_routine_diff_lines: 400
233
+
234
+ # Operational limits & governors (tier defaults shown; any key here overrides)
207
235
  limits:
208
- diffKb: 75 # 75 KB Diff Payload Governor limit
236
+ diffKb: 75 # Diff Payload Governor limit
209
237
  promptKb: 50 # Maximum prompt payload size
210
238
  dailyTasks: 300 # Task quota per rolling 24h window (not per calendar day)
211
239
  repairAttempts: 3 # Maximum repair iterations
212
- concurrency: 15 # Worker slots (free: 3, pro: 8, ultra: 15)
240
+ concurrency: 15 # Worker slots (defaults free: 3, pro: 8, ultra: 15)
213
241
 
214
242
  # Dynamic Complexity & Cost Router — opt-in, disabled by default.
215
243
  router:
@@ -312,6 +340,23 @@ const { provider, classification } = resolveRoutedProvider(
312
340
  console.log(classification.tier); // "fast" | "complex"
313
341
  ```
314
342
 
343
+ ### Syntax-Verified FAST Tier (`createSyntaxVerifiedProvider`)
344
+ `resolveRoutedProvider()` already wraps the FAST tier with this; use it directly only when composing your own provider cascade.
345
+ ```javascript
346
+ import { createProvider, createSyntaxVerifiedProvider, loadConfig } from "jules-orchestrator-kit";
347
+
348
+ const config = loadConfig(process.cwd());
349
+ const fast = createSyntaxVerifiedProvider(
350
+ createProvider("gemini-flash", config),
351
+ createProvider("jules", config),
352
+ config
353
+ );
354
+
355
+ // If gemini-flash leaves broken .js/.mjs/.cjs on disk, this transparently
356
+ // re-dispatches through "jules" instead of returning the broken result.
357
+ const result = await fast.dispatch({ prompt: "Fix a typo." }, { root: process.cwd() });
358
+ ```
359
+
315
360
  </details>
316
361
 
317
362
  <br/>
@@ -323,6 +368,8 @@ console.log(classification.tier); // "fast" | "complex"
323
368
 
324
369
  | Feature | Module / Command | Architectural Description | Status |
325
370
  | :--- | :--- | :--- | :---: |
371
+ | **Diagnostics That Reach the Operator** | `src/security.mjs`, `src/engine.mjs`, `bin/agentctl.mjs` | Secret findings name the file and line, a failed verify stage reports its command, exit code and output, and `queue`/`swarm` name each failed task and exit `1` rather than reporting success for a run that dispatched nothing. | **v0.41.1** *(Shipped)* |
372
+ | **One Scaffolding Path & First-Install Fixes** | `src/scaffold.mjs`, `src/security.mjs` | `agentctl init` and `jules-init` scaffold from one source and write the runtime `.gitignore` entries, so the kit's own bookkeeping no longer reaches its own gate; a lockfile bump no longer fails closed as a secret leak. | **v0.41.1** *(Shipped)* |
326
373
  | **Queue Runner Fidelity** | `src/dag-engine.mjs`, `src/engine.mjs` | Queue selection is by task shape rather than file extension, so manifests and READMEs are skipped instead of dispatched, and `--dry-run` leaves the queue untouched. | **v0.38.2** *(Shipped)* |
327
374
  | **Release Gate Enforcement & Wizard Smoke Test** | `.github/workflows/jules-audit.yml`, `scripts/release.mjs`, `test/wizard-smoke.test.mjs` | Doc-sync gate runs in CI rather than by hand, releases block on a green CI matrix for `HEAD`, per-test deadlines turn a hang into a failure, and the real `init` wizard is driven end to end over a fake TTY. | **v0.38.1** *(Shipped)* |
328
375
  | **Multi-OS CI Matrix & TUI Hardening** | `scripts/run-tests.mjs`, `src/state.mjs`, `src/git.mjs` | Automated 9-job CI matrix across Linux, macOS, and Windows on Node 20/22/24 with raw-mode TUI resilience and native Windows command quoting. | **v0.38.0** *(Shipped)* |