jules-orchestrator-kit 0.9.4 ā 0.21.0
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.
- package/.agent/prompts/Janitor.md +11 -0
- package/README.md +261 -259
- package/bin/agentctl.mjs +3 -3
- package/bin/init.js +16 -1
- package/index.mjs +11 -2
- package/package.json +2 -1
- package/scripts/jules-merge-swarm.mjs +179 -11
- package/scripts/release.mjs +103 -0
- package/src/config.mjs +37 -0
- package/src/engine.mjs +124 -3
- package/src/execution_envelope.mjs +103 -0
- package/src/git.mjs +20 -2
- package/src/mcp.mjs +120 -13
- package/src/process-group.mjs +80 -0
- package/src/risk.mjs +4 -2
- package/src/rules_budget.mjs +102 -0
- package/src/security.mjs +45 -6
- package/src/state.mjs +160 -23
- package/src/webhook.mjs +67 -18
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Janitor Protocol: Technical Debt & Dead Code Elimination
|
|
2
|
+
|
|
3
|
+
You are **Janitor**, a specialist autonomous agent optimized for technical debt elimination, dead code pruning, and strict zero-dependency refactoring.
|
|
4
|
+
|
|
5
|
+
## Strict Operational Invariants
|
|
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.
|
package/README.md
CHANGED
|
@@ -1,319 +1,321 @@
|
|
|
1
1
|
# jules-orchestrator-kit
|
|
2
2
|
|
|
3
|
-
*Disclaimer: This is an independent open-source orchestration tool and is not officially affiliated with or endorsed by Google.*
|
|
3
|
+
*Disclaimer: This is an independent open-source orchestration tool for Google Jules and is not officially affiliated with or endorsed by Google.*
|
|
4
4
|
|
|
5
5
|
[](https://github.com/FullThrottle83/jules-orchestrator-kit/actions/workflows/jules-audit.yml)
|
|
6
6
|
[](https://www.npmjs.com/package/jules-orchestrator-kit)
|
|
7
7
|
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://nodejs.org)
|
|
8
9
|
|
|
9
|
-
**
|
|
10
|
-
|
|
10
|
+
> **High-Volume Autonomous Orchestration Engine for Google Jules**
|
|
11
|
+
> Built specifically to execute 300+ daily agent sessions and parallel swarms safely. Zero external runtime dependencies. Built strictly on native Node.js 18+ ESM.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+

|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
> **Task Limit Warning:** Autonomous loops can quickly consume your daily API limits. We strongly recommend starting with `JULES_DRY_RUN=1` to understand the workflow before scaling up.
|
|
17
|
+
---
|
|
17
18
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
- `git` installed and available in your PATH
|
|
22
|
-
- A Google Jules REST API key (set as `JULES_API_KEY`) **OR** the native `jules` binary in your PATH.
|
|
19
|
+
## ā” 2-Minute Quickstart
|
|
20
|
+
|
|
21
|
+
Get up and running in under 2 minutes with zero complex configuration:
|
|
23
22
|
|
|
24
|
-
## Quick Start
|
|
25
|
-
Initialize your repository:
|
|
26
23
|
```bash
|
|
24
|
+
# 1. Initialize orchestrator structure in your target codebase
|
|
27
25
|
npx jules-orchestrator-kit init
|
|
26
|
+
|
|
27
|
+
# 2. Dispatch an autonomous task (Dry-Run mode for local simulation)
|
|
28
|
+
JULES_DRY_RUN=1 npx agentctl dispatch \
|
|
29
|
+
--title "Add JWT Validator" \
|
|
30
|
+
--prompt "Implement JWT validation middleware with unit tests"
|
|
31
|
+
|
|
32
|
+
# 3. Run the 4-phase security & verification gatekeeper
|
|
33
|
+
npx agentctl gate
|
|
34
|
+
|
|
35
|
+
# 4. Connect as a native stdio MCP server (for Claude Code, Cursor, or Antigravity)
|
|
36
|
+
npx agentctl mcp
|
|
28
37
|
```
|
|
29
38
|
|
|
30
|
-
|
|
39
|
+
> š **Looking for production deployment patterns?**
|
|
40
|
+
> Check out [**EXAMPLES.md**](./EXAMPLES.md) for 6 real-world recipes (Nightly TODO Scanner, Composite CI Action, Multi-Worktree Swarms, OODA Auto-Fix, MCP IDE setup, and Specialist Rosters).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## šÆ Why jules-orchestrator-kit?
|
|
45
|
+
|
|
46
|
+
Whether you are dispatching your first automated coding task or managing high-throughput CI/CD swarms across large engineering teams, `jules-orchestrator-kit` provides total operational safety:
|
|
47
|
+
|
|
48
|
+
| Feature | š£ For Rookies & Beginners | š ļø For Senior Developers & Infrastructure Engineers |
|
|
49
|
+
| :--- | :--- | :--- |
|
|
50
|
+
| **Safety First** | Never breaks `main` branch or pushes failing code. | 4-Phase Safety Gatekeeper fails closed on scope drift, high entropy secrets, or test regressions. |
|
|
51
|
+
| **Token Budget Protection** | Prevents runaway loops from burning API quotas. | Sliding-window OODA thrash detector ($A \rightarrow B \rightarrow A \rightarrow B$) halts non-convergent repair cycles automatically. |
|
|
52
|
+
| **Zero Setup Hassle** | Works out of the box with standard `npm test`. | **Zero External Runtime Dependencies** (`node:fs`, `node:path`, `node:crypto`, `node:child_process`). |
|
|
53
|
+
| **Multi-Agent Swarms** | Run multiple tasks simultaneously without conflict. | Deterministic VFS mutex and 3-way structural merge engine resolve parallel worktree changes cleanly. |
|
|
54
|
+
| **IDE & Tooling** | Seamlessly connects to your favorite editor. | Native Model Context Protocol (MCP) server over memory-bounded stdio streams. |
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
<details open>
|
|
59
|
+
<summary><b>āļø Control Plane Architecture & Deep Dive</b></summary>
|
|
60
|
+
|
|
61
|
+
<br/>
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
<br/>
|
|
66
|
+
|
|
67
|
+

|
|
68
|
+
|
|
69
|
+
### Engine System Highlights
|
|
70
|
+
|
|
71
|
+
- **Linearizable VFS Mutex (`src/state.mjs`)**: Kernel-level directory mutex (`withVfsMutex`) guaranteeing serial linearizability for SHA-256 hash-chained session ledgers under high concurrency.
|
|
72
|
+
- **PID Recycling & Stale Lock Protection (`src/state.mjs`)**: Linux `/proc/<pid>/stat` launch-time validation prevents false-positive lock reaps from recycled OS process IDs.
|
|
73
|
+
- **Memory-Bounded Content-Length MCP Streaming (`src/mcp.mjs`)**: Native MCP server over stdio streams using `McpFrameDecoder` with a 4 MB memory safety ceiling and panic boundaries to prevent stdout stack trace leaks.
|
|
74
|
+
- **Process Group Isolation (`src/process-group.mjs`)**: `ProcessGroupManager` creates isolated process groups (`detached: true`) and catches `SIGINT`/`SIGTERM`/`exit` signals to execute `process.kill(-pgid)`, guaranteeing zero zombie processes.
|
|
75
|
+
- **TOCTOU & Symlink Defense (`src/security.mjs`)**: `safeAtomicWrite()` uses `O_CREAT | O_EXCL | O_WRONLY` temp files with `fsyncSync` + `renameSync` and `lstatSync`/`realpathSync` symlink checks.
|
|
76
|
+
- **3-Way Structural AST/JSON Merge (`scripts/jules-merge-swarm.mjs`)**: Pure Node `deepMerge3Way()` algorithm for recursive object and array merges executed in isolated temporary directories (`os.tmpdir()`).
|
|
77
|
+
|
|
78
|
+
</details>
|
|
79
|
+
|
|
80
|
+
<details>
|
|
81
|
+
<summary><b>š”ļø Zero-Trust Security Gatekeeper</b></summary>
|
|
82
|
+
|
|
83
|
+
<br/>
|
|
84
|
+
|
|
85
|
+

|
|
86
|
+
|
|
87
|
+
### The 4-Phase Safety Audit (`agentctl gate`)
|
|
88
|
+
|
|
89
|
+
1. **Scope Fencing (`forbidden_paths`)**: Ensures agents cannot modify protected files (`package.json`, `.github/`, deployment keys) without explicit overrides.
|
|
90
|
+
2. **Diff Payload Governor**: Rejects oversized diffs (> 75 KB) to prevent truncation and hidden payload injections.
|
|
91
|
+
3. **Secret Entropy Scanner**: Scans diffs for high-confidence secrets (AWS keys, Stripe keys, GitHub tokens, SSH private keys) using Shannon Entropy analysis (> 3.6 bits).
|
|
92
|
+
4. **Trusted Verification Suite**: Executes auto-detected unit tests and linters (`npm test`) to guarantee zero regressions before merging.
|
|
93
|
+
|
|
94
|
+
> [!NOTE]
|
|
95
|
+
> All security rules are fetched strictly from `origin/main` (never untrusted PR branches) to prevent prompt-injection attacks from altering security rules.
|
|
96
|
+
|
|
97
|
+
</details>
|
|
98
|
+
|
|
99
|
+
<details>
|
|
100
|
+
<summary><b>š Model Context Protocol (MCP) & IDE Integration</b></summary>
|
|
101
|
+
|
|
102
|
+
<br/>
|
|
103
|
+
|
|
104
|
+

|
|
105
|
+
|
|
106
|
+
### Connecting to Claude Desktop, Cursor, or Antigravity
|
|
107
|
+
|
|
108
|
+
Start the native stdio MCP server:
|
|
109
|
+
|
|
31
110
|
```bash
|
|
32
|
-
agentctl
|
|
33
|
-
agentctl queue
|
|
34
|
-
agentctl gate
|
|
111
|
+
npx agentctl mcp
|
|
35
112
|
```
|
|
36
113
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
114
|
+
#### MCP Tool Registry Exposed:
|
|
115
|
+
- `dispatch_jules_task`: Dispatch autonomous coding tasks directly from your LLM prompt.
|
|
116
|
+
- `audit_jules_gate`: Execute the 4-phase safety gate against the workspace.
|
|
117
|
+
- `check_risk_tier`: Classify workspace changes into Risk Tiers (R0 Cosmetic to R3 Restricted).
|
|
118
|
+
- `get_jules_status`: Fetch real-time status of active, pending, and completed tasks.
|
|
40
119
|
|
|
41
|
-
|
|
120
|
+
</details>
|
|
42
121
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
participant Envelope as Task Envelope Validator
|
|
62
|
-
participant Gate as Self-Audit Gatekeeper
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
box "Execution Sandbox" #F8E8E8
|
|
66
|
-
participant API as Google Jules API
|
|
67
|
-
participant Git as Git Worktree Sandbox
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
Trigger->>+Orc: Dispatch Task Payload / Envelope
|
|
71
|
-
|
|
72
|
-
note over Orc,Envelope: Phase 1: Pre-Flight Premise & Security Validation
|
|
73
|
-
Orc->>+Envelope: Validate Envelope (referenced_paths exist? base commit fresh?)
|
|
74
|
-
alt Premise Failure / Missing Referenced Paths / Stale Base
|
|
75
|
-
Envelope-->>Orc: Validation Failed (Premise Error)
|
|
76
|
-
Orc-->>Trigger: Abort Pre-Dispatch (Exit 1)
|
|
77
|
-
else Envelope Validated
|
|
78
|
-
Envelope-->>-Orc: Envelope Approved
|
|
79
|
-
Orc->>Orc: Redact Secrets (Entropy > 3.6) & Enforce Dynamic Guardrails
|
|
80
|
-
Orc->>+Git: Provision Isolation Sandbox (git worktree)
|
|
81
|
-
Git-->>-Orc: Sandbox Ready
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
loop OODA Repair Cycle (Max 3 Retries)
|
|
85
|
-
note over Orc,Git: Phase 2: Agent Execution & Dispatch
|
|
86
|
-
Orc->>+API: Dispatch Task + <MCP_DIRECTIVE> & Target Scope
|
|
87
|
-
API->>+Git: Apply Proposed Code Changes
|
|
88
|
-
Git-->>-API: Changes Written
|
|
89
|
-
API-->>-Orc: Execution Complete
|
|
90
|
-
|
|
91
|
-
note over Orc,Gate: Phase 3: Multi-Gate Verification & Risk Classification
|
|
92
|
-
Orc->>+Gate: Trigger Self-Audit (trusted origin/main rules)
|
|
93
|
-
|
|
94
|
-
Gate->>+Git: Run Scope, Payload & Stale-Base Audit (`git diff`)
|
|
95
|
-
Git-->>-Gate: Diff Stats & Base Commit Age
|
|
96
|
-
|
|
97
|
-
alt Scope Breach / Payload > 75 KB / Stale Base > 25 commits
|
|
98
|
-
Gate-->>Orc: Security / Scope / Stale-Base Violation
|
|
99
|
-
Orc->>Orc: Record Telemetry (metrics.jsonl)
|
|
100
|
-
Orc-->>Trigger: Abort Execution (Exit 3)
|
|
101
|
-
break Fatal Security or Base Error
|
|
102
|
-
Orc->>Git: Teardown Worktree Sandbox
|
|
103
|
-
end
|
|
104
|
-
else Static Scope & Base Passed
|
|
105
|
-
Gate->>Gate: Classify Risk Tier (R0 Cosmetic, R1 Routine, R2 Consequential, R3 Restricted)
|
|
106
|
-
Gate->>+Git: Run Integrity Checks (Asset Magic-Bytes, Rules Budget, testCmd & buildCmd)
|
|
107
|
-
Git-->>-Gate: Execution & Integrity Proof (stdout/stderr)
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
alt 100% Verification Suite & Integrity Passed
|
|
111
|
-
Gate-->>-Orc: Verification Success + Risk Tier Metadata
|
|
112
|
-
Orc->>+Git: Commit & Push to Remote Branch / PR
|
|
113
|
-
Git-->>-Orc: PR Ready (Attached Execution Receipts)
|
|
114
|
-
Orc->>Orc: Record Telemetry (metrics.jsonl)
|
|
115
|
-
Orc-->>Trigger: Dispatch Succeeded (Exit 0)
|
|
116
|
-
break Task Completed
|
|
117
|
-
Orc->>Git: Teardown Worktree Sandbox
|
|
118
|
-
end
|
|
119
|
-
else Verification Failed
|
|
120
|
-
Gate-->>Orc: Verification Failed (Stderr Trace output)
|
|
121
|
-
Orc->>Orc: Record Failure Telemetry
|
|
122
|
-
|
|
123
|
-
alt Retries Remaining (< 3)
|
|
124
|
-
Orc->>Orc: Construct Repair Prompt with Stderr Trace
|
|
125
|
-
else Max Retries Exceeded (3/3)
|
|
126
|
-
Orc-->>-Trigger: Abort & Log Diagnostic Feedback (Exit 4)
|
|
127
|
-
Orc->>Git: Teardown Worktree Sandbox
|
|
128
|
-
end
|
|
129
|
-
end
|
|
130
|
-
end
|
|
122
|
+
<details>
|
|
123
|
+
<summary><b>š¤ Specialist Agent Prompt Presets (.agent/prompts/)</b></summary>
|
|
124
|
+
|
|
125
|
+
<br/>
|
|
126
|
+
|
|
127
|
+
Specialized prompt presets enforcement payload limits (< 75 KB) and domain guardrails out of the box:
|
|
128
|
+
|
|
129
|
+
| Preset | Role & Domain | Primary Focus |
|
|
130
|
+
| :--- | :--- | :--- |
|
|
131
|
+
| **`Overseer.md`** | **Architect & Supervisor** | System-wide refactoring, linearizable state, and structural integrity. |
|
|
132
|
+
| **`Bolt.md`** | **Performance Engineer** | Bottleneck elimination, streaming optimization, and low-latency execution. |
|
|
133
|
+
| **`Sentinel.md`** | **Security Auditor** | Vulnerability patching, secret sanitization, and TOCTOU defense. |
|
|
134
|
+
| **`Janitor.md`** | **Technical Debt & Cleanup** | Dead code elimination, unused import pruning, and zero-dependency compliance. |
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Example: Dispatch a cleanup task using the Janitor preset
|
|
138
|
+
npx agentctl dispatch \
|
|
139
|
+
--prompt "$(cat .agent/prompts/Janitor.md) Prune unused helper methods in src/utils.mjs"
|
|
131
140
|
```
|
|
132
141
|
|
|
133
|
-
>
|
|
134
|
-
> - **Task Envelope Premise Validation**: Pre-flight checks verify referenced paths and base freshness before dispatching tasks to prevent session burnout.
|
|
135
|
-
> - **Risk Tier Classification Engine (R0āR3)**: Classifies changes by blast radius to route auto-merge vs mandatory human review.
|
|
136
|
-
> - **Zero-Trust Base-Branch Security**: Security rules (`forbidden_paths`) are fetched exclusively from `origin/main` (never untrusted PR branches).
|
|
137
|
-
> - **Asset & Rules Integrity**: Guards binary assets against HTML corruption and enforces character/line budgets on rule files.
|
|
138
|
-
> - **Automatic PII & Secret Redaction**: Outbound task prompts are automatically sanitized to redact API secrets and mask sensitive PII (emails, IPs, phone numbers).
|
|
139
|
-
> - **Ledger Hash-Chain Integrity**: Hashing over JSONL event streams detects unauthorized log tampering or record deletions.
|
|
140
|
-
>
|
|
141
|
-
> š For a deep dive into the execution protocol, see the [Architecture & Pipeline Flow](docs/architecture.md).
|
|
142
|
+
</details>
|
|
142
143
|
|
|
143
|
-
|
|
144
|
+
<details>
|
|
145
|
+
<summary><b>ā” GitHub Actions Composite Action (.github/actions/setup-jules)</b></summary>
|
|
146
|
+
|
|
147
|
+
<br/>
|
|
148
|
+
|
|
149
|
+
Integrate `jules-orchestrator-kit` into any GitHub Actions workflow with 3 lines of YAML:
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
steps:
|
|
153
|
+
- uses: actions/checkout@v4
|
|
154
|
+
- uses: FullThrottle83/jules-orchestrator-kit/.github/actions/setup-jules@main
|
|
155
|
+
with:
|
|
156
|
+
action: 'gate'
|
|
157
|
+
base_branch: 'main'
|
|
158
|
+
tier: 'ultra'
|
|
159
|
+
env:
|
|
160
|
+
JULES_API_KEY: ${{ secrets.JULES_API_KEY }}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
</details>
|
|
164
|
+
|
|
165
|
+
<details>
|
|
166
|
+
<summary><b>š ļø CLI Command Reference (`agentctl`)</b></summary>
|
|
167
|
+
|
|
168
|
+
<br/>
|
|
169
|
+
|
|
170
|
+
| Command | Usage Example | Description |
|
|
171
|
+
| :--- | :--- | :--- |
|
|
172
|
+
| **`init`** | `npx agentctl init` | Initializes `.agent/` configuration, workflows, and task queue directory |
|
|
173
|
+
| **`dispatch`** | `agentctl dispatch --title "Fix Bug" --prompt "..."` | Dispatches an autonomous task to Google Jules |
|
|
174
|
+
| **`gate`** | `agentctl gate [--fix] [--base main]` | Runs 4-phase safety gatekeeper audit against workspace |
|
|
175
|
+
| **`queue`** | `agentctl queue` | Processes pending task queue sequentially from `.agent/jules-queue/` |
|
|
176
|
+
| **`swarm`** | `agentctl swarm` | Launches parallel multi-agent swarm in isolated git worktrees |
|
|
177
|
+
| **`merge-swarm`** | `agentctl merge-swarm` | Performs 3-way structural merge on completed swarm PRs |
|
|
178
|
+
| **`mcp`** | `agentctl mcp` | Starts stdio Model Context Protocol (MCP) JSON-RPC 2.0 server |
|
|
179
|
+
| **`doctor`** | `agentctl doctor` | Verifies stack configuration, environment keys, and daily token budget |
|
|
180
|
+
| **`scan`** | `agentctl scan` | Scans codebase for `TODO` and `FIXME` comments and generates task queue |
|
|
181
|
+
| **`cleanup`** | `agentctl cleanup` | Audits and cleans up stale git worktrees and temporary state files |
|
|
182
|
+
|
|
183
|
+
</details>
|
|
184
|
+
|
|
185
|
+
<details>
|
|
186
|
+
<summary><b>š³ Subscription Tier Presets (Free / Pro / Ultra)</b></summary>
|
|
187
|
+
|
|
188
|
+
<br/>
|
|
144
189
|
|
|
145
|
-
|
|
190
|
+

|
|
146
191
|
|
|
147
|
-
|
|
192
|
+
<br/>
|
|
193
|
+
|
|
194
|
+
Tailor session limits and rate-limiting behavior to your Google Jules API subscription tier:
|
|
195
|
+
|
|
196
|
+
| Tier | `dailyTasks` | `repairAttempts` | `concurrency` | `staggerMs` | Target Usage |
|
|
197
|
+
| :--- | :---: | :---: | :---: | :---: | :--- |
|
|
198
|
+
| **`free`** | `15` | `1` | `1` | `3000 ms` | **Hobby / Free Tier:** Conserves quota, prevents HTTP 429 rate limits. |
|
|
199
|
+
| **`pro`** | `100` | `2` | `2` | `1500 ms` | **Developer Pro:** Balanced throughput for everyday work. |
|
|
200
|
+
| **`ultra`** *(default)* | `300` | `3` | `3` | `1000 ms` | **Swarm / Enterprise:** Maximum parallel throughput & CI/CD. |
|
|
201
|
+
|
|
202
|
+
**How to activate:**
|
|
203
|
+
- **Environment Variable:** `export JULES_TIER=free` (or set in `.env`)
|
|
204
|
+
- **Config File (`.agent/jules.yml`):** Set `tier: free`
|
|
205
|
+
|
|
206
|
+
</details>
|
|
207
|
+
|
|
208
|
+
<details>
|
|
209
|
+
<summary><b>š Configuration Reference (`.agent/jules.yml`)</b></summary>
|
|
210
|
+
|
|
211
|
+
<br/>
|
|
212
|
+
|
|
213
|
+
Auto-generated by `agentctl init` at the root of your project:
|
|
148
214
|
|
|
149
215
|
```yaml
|
|
150
|
-
# Google Jules Repository Configuration (Version 2)
|
|
151
216
|
version: 2
|
|
217
|
+
tier: "pro" # Options: free, pro, ultra (default: ultra)
|
|
152
218
|
test_cmd: "npm test"
|
|
153
219
|
build_cmd: "npm run build"
|
|
154
220
|
forbidden_paths:
|
|
155
|
-
- ".github
|
|
156
|
-
- "
|
|
157
|
-
- "**/*.pem"
|
|
158
|
-
- "**/lock-manager/**"
|
|
159
|
-
- "scripts/jules-*"
|
|
221
|
+
- ".github/"
|
|
222
|
+
- "package.json"
|
|
160
223
|
- ".agent/jules.yml"
|
|
161
224
|
allow_paths: []
|
|
225
|
+
limits:
|
|
226
|
+
dailyTasks: 300
|
|
227
|
+
repairAttempts: 3
|
|
228
|
+
diffKb: 75
|
|
162
229
|
```
|
|
163
230
|
|
|
164
|
-
|
|
231
|
+
</details>
|
|
165
232
|
|
|
166
|
-
|
|
233
|
+
<details>
|
|
234
|
+
<summary><b>š¦ Exit Code Registry & Troubleshooting</b></summary>
|
|
167
235
|
|
|
168
|
-
|
|
236
|
+
<br/>
|
|
169
237
|
|
|
170
|
-
|
|
171
|
-
* **SaaS APIs & Tooling:** Context 7, Linear, and v0.
|
|
172
|
-
* **Databases & Cloud:** Render, Neon, Supabase, Stitch.
|
|
173
|
-
* **Framework Documentation:** Astro Docs, Cloudflare Docs, Next.js Docs.
|
|
238
|
+
Standardized exit codes enforced across all CLI utilities:
|
|
174
239
|
|
|
175
|
-
|
|
240
|
+
| Exit Code | Status | Description & Immediate Action |
|
|
241
|
+
| :---: | :--- | :--- |
|
|
242
|
+
| `0` | **Success** | Task completed cleanly; PR opened or verification passed. |
|
|
243
|
+
| `1` | **Pre-Dispatch / Arg Error** | Invalid arguments, prompt > 50 KB, or pre-dispatch validation error. |
|
|
244
|
+
| `2` | **API / Network Failure** | Jules API rate-limit (HTTP 429), `FAILED_PRECONDITION` quota, or timeout. |
|
|
245
|
+
| `3` | **Scope Violation** | Attempted modification of restricted files (`.github/`, command files, agent rules). |
|
|
246
|
+
| `4` | **OODA Exhausted / Thrash** | Verification suite failed after 3 repair attempts or hit deterministic regression. |
|
|
247
|
+
| `5` | **Diff Payload Limit** | Post-change git diff exceeds payload budget (`limits.diffKb`, default 75 KB). |
|
|
248
|
+
| `6` | **Secret Detected** | High-confidence secret or private key detected in patch diff. |
|
|
249
|
+
| `7` | **Budget Exhausted** | Daily task session quota limit reached (`limits.dailyTasks`, default 300). |
|
|
176
250
|
|
|
177
|
-
|
|
251
|
+
</details>
|
|
178
252
|
|
|
179
|
-
|
|
253
|
+
<details>
|
|
254
|
+
<summary><b>š Environment Variables Reference</b></summary>
|
|
180
255
|
|
|
181
|
-
|
|
182
|
-
When `JULES_API_KEY` and `JULES_REPO` are present in your environment, payloads are dispatched directly to the official Google Jules REST API endpoint. Handles HTTP 429 rate limits gracefully.
|
|
256
|
+
<br/>
|
|
183
257
|
|
|
184
|
-
|
|
185
|
-
|
|
258
|
+
| Variable | Description | Default |
|
|
259
|
+
| :--- | :--- | :--- |
|
|
260
|
+
| `JULES_API_KEY` | Google Jules REST API key | *(none)* |
|
|
261
|
+
| `JULES_REPO` | Target GitHub Repository (`owner/repo`) | Auto-detected from `git remote` |
|
|
262
|
+
| `JULES_TIER` | Subscription tier preset (`free`, `pro`, `ultra`) | `ultra` |
|
|
263
|
+
| `JULES_DRY_RUN` | Set to `1` or `true` for dry-run simulation mode | `false` |
|
|
264
|
+
| `JULES_DAILY_BUDGET` | Custom daily session budget limit | `300` |
|
|
265
|
+
| `JULES_MAX_DIFF_KB` | Custom git diff payload limit in KB | `75` |
|
|
266
|
+
| `JULES_ALLOW_COMMAND_FILE_CHANGES` | Allow PR changes to command files (`package.json`, etc.) | `false` |
|
|
267
|
+
| `JULES_ALLOW_AGENT_RULE_CHANGES` | Allow PR changes to agent rule files (`AGENTS.md`, etc.) | `false` |
|
|
268
|
+
| `BASE_BRANCH` | Base branch for PR Audits & Merge-Base checks | `main` |
|
|
269
|
+
| `NO_COLOR` | Set to `true` to disable ANSI color output | `false` |
|
|
186
270
|
|
|
187
|
-
|
|
188
|
-
Downstream Node.js tools, MCP servers, and LLM orchestrators can import kit functions directly:
|
|
189
|
-
```js
|
|
190
|
-
import { gate, dispatch, validateEnvelope, classifyRiskTier, checkAssetIntegrity, checkRulesBudget, redactSecrets } from "jules-orchestrator-kit";
|
|
271
|
+
</details>
|
|
191
272
|
|
|
192
|
-
|
|
193
|
-
|
|
273
|
+
<details>
|
|
274
|
+
<summary><b>š Supported Tech Stacks & Auto-Detection</b></summary>
|
|
194
275
|
|
|
195
|
-
|
|
196
|
-
await dispatch({ title: "Refactor Auth", prompt: cleanPrompt });
|
|
276
|
+
<br/>
|
|
197
277
|
|
|
198
|
-
|
|
199
|
-
const audit = await gate({ base: "main" });
|
|
200
|
-
```
|
|
278
|
+
The orchestrator automatically infers verification and build commands across ecosystems:
|
|
201
279
|
|
|
202
|
-
|
|
280
|
+
| Stack / Ecosystem | Manifest File | Inferred Test Command | Inferred Build Command |
|
|
281
|
+
| :--- | :--- | :--- | :--- |
|
|
282
|
+
| **Turborepo** | `turbo.json` | `npx turbo run test` | `npx turbo run build` |
|
|
283
|
+
| **pnpm Workspace** | `pnpm-workspace.yaml` | `pnpm test` | `pnpm build` |
|
|
284
|
+
| **Nx Workspace** | `nx.json` | `npx nx run-many -t test` | `npx nx run-many -t build` |
|
|
285
|
+
| **JavaScript / TypeScript** | `package.json` | `npm test` | `npm run build` |
|
|
286
|
+
| **Rust** | `Cargo.toml` | `cargo test --workspace` | `cargo build` |
|
|
287
|
+
| **Go** | `go.mod` | `go test ./...` | `go build ./...` |
|
|
288
|
+
| **Python** | `pyproject.toml` | `pytest` | *(none)* |
|
|
289
|
+
| **Bun / Deno** | `bunfig.toml` / `deno.json` | `bun test` / `deno test` | `bun run build` |
|
|
290
|
+
| **Elixir / Ruby** | `mix.exs` / `Gemfile` | `mix test` / `rake test` | *(standard build)* |
|
|
291
|
+
| **Java / C / C++** | `pom.xml` / `Makefile` | `mvn test` / `make test` | `mvn compile` / `make` |
|
|
203
292
|
|
|
204
|
-
|
|
293
|
+
</details>
|
|
205
294
|
|
|
206
|
-
|
|
207
|
-
Currently, there is no way to automatically extract "Suggestions" (the inline code review comments Jules sometimes proposes instead of direct commits) via the CLI or API. Suggestions can only be read directly inside the **Jules Web UI**.
|
|
295
|
+
---
|
|
208
296
|
|
|
209
|
-
|
|
297
|
+
## š¤ Contributing & Standards
|
|
210
298
|
|
|
211
|
-
|
|
299
|
+
We welcome community contributions! Please adhere to our core engineering invariants:
|
|
212
300
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
| --------------------------- | ------------------------------------- | ---------------------------------------- | ---------------------------------------- |
|
|
217
|
-
| **Turborepo** | `turbo.json` | `npx turbo run test --filter=...` | `npx turbo run build --filter=...` |
|
|
218
|
-
| **pnpm Workspace** | `pnpm-workspace.yaml` | `pnpm --filter=... test` | `pnpm --filter=... build` |
|
|
219
|
-
| **Nx Workspace** | `nx.json` | `npx nx run-many -t test -p ...` | `npx nx run-many -t build -p ...` |
|
|
220
|
-
| **Bun** | `bunfig.toml` / `bun.lockb` | `bun test` | `bun run build` |
|
|
221
|
-
| **Deno** | `deno.json` / `deno.jsonc` | `deno test` | `deno task build` |
|
|
222
|
-
| **JavaScript / TypeScript** | `package.json` | `npm test` | `npm run build` |
|
|
223
|
-
| **Rust** | `Cargo.toml` | `cargo test --workspace` | `cargo build` |
|
|
224
|
-
| **Go** | `go.mod` | `go test ./...` | `go build ./...` |
|
|
225
|
-
| **Python** | `pyproject.toml` / `requirements.txt` | `pytest` | *(none)* |
|
|
226
|
-
| **Elixir** | `mix.exs` | `mix test` | `mix compile` |
|
|
227
|
-
| **Ruby** | `Gemfile` | `bundle exec rake test` | *(none)* |
|
|
228
|
-
| **Swift** | `Package.swift` | `swift test` | `swift build` |
|
|
229
|
-
| **Java (Maven/Gradle)** | `pom.xml` / `build.gradle` | `mvn test` / `./gradlew test` | `mvn compile` / `./gradlew assemble` |
|
|
230
|
-
| **C / C++** | `Makefile` | `make test` | `make build` |
|
|
301
|
+
1. **Zero External Runtime Dependencies**: Use ONLY native Node.js ESM built-in modules (`node:fs`, `node:path`, `node:crypto`, `node:child_process`, `node:os`).
|
|
302
|
+
2. **100% Verification Suite**: All test suites must pass cleanly with 0 errors.
|
|
303
|
+
3. **Cross-Platform Compatibility**: Always normalize Windows backslashes (`\`) to POSIX slashes (`/`).
|
|
231
304
|
|
|
232
|
-
|
|
305
|
+
### Running Tests Locally
|
|
233
306
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
| Command | Description |
|
|
240
|
-
| ------- | ----------- |
|
|
241
|
-
| `npm run init` | Initializes the orchestrator and `.agent/` directory |
|
|
242
|
-
| `npm run test` | Runs the orchestrator kit's own unit tests |
|
|
243
|
-
| `npm run jules:dispatch` | Dispatches a single task directly to Jules |
|
|
244
|
-
| `npm run jules:queue` | Runs the local queue processor (picks up tasks from `.agent/jules-queue`) |
|
|
245
|
-
| `npm run jules:create` | Scaffolds a new boilerplate task markdown file |
|
|
246
|
-
| `npm run jules:status` | Shows real-time 3-bucket status (Action Required, In Progress, Completed) |
|
|
247
|
-
| `npm run jules:audit` | Runs the self-audit gatekeeper (verifies tests, forbidden paths, and scope) |
|
|
248
|
-
| `npm run jules:cleanup` | Audits and closes merged or stale REST sessions |
|
|
249
|
-
| `npm run jules:scan` | Scans the codebase for TODO/FIXME comments and generates a suggested tasks file |
|
|
250
|
-
| `npm run jules:swarm` | Launches a multi-agent swarm in parallel across isolated worktrees |
|
|
251
|
-
| `npm run jules:merge-swarm` | Autonomous PR merge engine with Safety Gate lock verification |
|
|
252
|
-
| `npm run jules:nightly` | Nightly maintenance job (usually triggered in CI) |
|
|
253
|
-
|
|
254
|
-
### Specialist Agent Prompts & Templates (`.agent/prompts/`)
|
|
255
|
-
The kit includes pre-configured single-responsibility prompt presets in `.agent/prompts/`:
|
|
256
|
-
- **`Overseer.md`**: Codebase architecture auditor & technical debt mapper.
|
|
257
|
-
- **`Bolt.md`**: Performance micro-optimizer and payload governor (enforces < 75 KB payload diff limits).
|
|
258
|
-
- **`Sentinel.md`**: Security audit specialist for input sanitization and secret scanning.
|
|
259
|
-
- **`Task_Template.md`**: Machine-readable master task prompt template schema.
|
|
260
|
-
|
|
261
|
-
### Environment Variables
|
|
262
|
-
|
|
263
|
-
| Variable | Description |
|
|
264
|
-
| -------- | ----------- |
|
|
265
|
-
| `JULES_API_KEY` | Your Google Jules REST API key (required for API mode) |
|
|
266
|
-
| `GEMINI_API_KEY` | Alias for `JULES_API_KEY` (fallback) |
|
|
267
|
-
| `JULES_API_URL` | Override the Jules REST API URL |
|
|
268
|
-
| `JULES_REPO` | Target GitHub Repository (Format: `owner/repo`) |
|
|
269
|
-
| `JULES_REPOLESS` | Set to `true` or `1` to run in repoless/serverless mode |
|
|
270
|
-
| `JULES_DRY_RUN` | Set to `true` or `1` to simulate dispatching without making API calls |
|
|
271
|
-
| `JULES_DAILY_BUDGET` | Daily max session budget for autonomous dispatches (Default: `300`) |
|
|
272
|
-
| `JULES_MAX_DIFF_KB` | Maximum git diff payload size in KB before aborting with Exit Code 5 (Default: `50`) |
|
|
273
|
-
| `JULES_ALLOW_COMMAND_FILE_CHANGES` | Set to `true` to allow PR changes to command/config files like `package.json`, `tsconfig.json`, `vite.config.ts` (Default: `false`) |
|
|
274
|
-
| `JULES_ALLOW_AGENT_RULE_CHANGES` | Set to `true` to allow PR changes to agent rule files like `AGENTS.md`, `JULES_RULES_TEMPLATE.md` (Default: `false`) |
|
|
275
|
-
| `BASE_BRANCH` | Base branch for PR Audits & Merge-Base calculations (Default: `main`) |
|
|
276
|
-
| `GITHUB_HEAD_REF` | PR Head Branch (Used dynamically by CI during OODA repair) |
|
|
277
|
-
| `JULES_PROJECT_ROOT` | Root directory of the project (Auto-assigned during swarm executions) |
|
|
278
|
-
| `JULES_SWARM_CONCURRENCY` | Maximum parallel dispatches for swarm runs (Default: `3`) |
|
|
279
|
-
| `JULES_SWARM_STAGGER_MS` | Dispatch stagger interval in milliseconds (Default: `1500`) |
|
|
280
|
-
| `JULES_PACE_MS` | Rate-limit for the `jules:queue` command (Default: `500`) |
|
|
281
|
-
| `JULES_USE_WORKTREES` | Use Git Worktrees instead of cloning for swarm isolation (Default: `false`) |
|
|
282
|
-
| `JULES_SLOT_INDEX` | Current slot index for partitioning tasks (Swarm mode) |
|
|
283
|
-
| `JULES_SLOT_TOTAL` | Total number of slots for partitioning tasks (Swarm mode) |
|
|
284
|
-
| `CI` | Set to `true` to change log output and fail-fast behaviors for CI environments |
|
|
285
|
-
| `ALLOW_AUTO_REPAIR` | Set to `true` to allow OODA Auto-Repair even when running in CI |
|
|
286
|
-
| `GITHUB_STEP_SUMMARY` | GitHub Actions Step Summary File Path |
|
|
287
|
-
| `NO_COLOR` | Set to `true` to disable ANSI color output |
|
|
307
|
+
```bash
|
|
308
|
+
# Clone the repository
|
|
309
|
+
git clone https://github.com/FullThrottle83/jules-orchestrator-kit.git
|
|
310
|
+
cd jules-orchestrator-kit
|
|
288
311
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
### Exit Codes
|
|
294
|
-
The Gatekeeper (`jules-self-audit.mjs` and related scripts) uses standard exit codes to signal status to CI systems.
|
|
295
|
-
|
|
296
|
-
| Code | Meaning | Action Taken |
|
|
297
|
-
| ---- | ------- | ------------ |
|
|
298
|
-
| `0` | **Success** | All tests and security checks passed. |
|
|
299
|
-
| `1` | **Pre-Dispatch / Arg Error** | Missing dependencies, prompt > 50 KB, syntax error, or pre-dispatch failure. |
|
|
300
|
-
| `2` | **API / Network / Quota Error** | REST API HTTP 429 rate limit, HTTP 400 `FAILED_PRECONDITION` quota (~30 active limit), or connection timeout. |
|
|
301
|
-
| `3` | **Security / Scope Violation** | Modified file breached `forbidden_paths` or changed command-defining files (`package.json`, `Cargo.toml`). Fails closed immediately. |
|
|
302
|
-
| `4` | **Verification Exhausted** | Tests failed and the OODA Auto-Repair loop either exhausted its max retries (3) or is disabled. |
|
|
303
|
-
| `5` | **Diff Payload Limit** | Diff payload size exceeded payload governor budget (`JULES_MAX_DIFF_KB`, default 50 KB). Split task. |
|
|
304
|
-
| `6` | **Secret Leak Prevented** | High-confidence secret or private key pattern detected in diff. Aborted immediately. |
|
|
305
|
-
| `7` | **Budget Exhausted** | Daily session budget limit reached or budget state locked. |
|
|
312
|
+
# Run ESLint & node unit test suite (100% zero external runtime deps)
|
|
313
|
+
npm run lint
|
|
314
|
+
npm test
|
|
315
|
+
```
|
|
306
316
|
|
|
307
317
|
---
|
|
308
318
|
|
|
309
|
-
##
|
|
310
|
-
We welcome contributions! Please follow these core principles:
|
|
311
|
-
1. **Zero Runtime Dependencies**: Use ONLY native Node.js built-in modules (`node:fs`, `node:path`, `node:child_process`, `node:crypto`, `node:util`).
|
|
312
|
-
2. **Verification Suite**: Ensure 100% of unit tests pass cleanly (`npm test`).
|
|
313
|
-
3. **Conventional Commits**: Use standardized prefixes (`feat:`, `fix:`, `docs:`, `test:`, `chore:`).
|
|
314
|
-
4. **Cross-Platform Compatibility**: Normalize Windows backslashes (`\`) to POSIX slashes (`/`) for glob patterns and paths.
|
|
315
|
-
|
|
316
|
-
Please read our [Code of Conduct](CODE_OF_CONDUCT.md) before participating.
|
|
319
|
+
## š License
|
|
317
320
|
|
|
318
|
-
|
|
319
|
-
MIT License - feel free to use, modify, and share!
|
|
321
|
+
Distributed under the [MIT License](LICENSE).
|
package/bin/agentctl.mjs
CHANGED
|
@@ -13,7 +13,7 @@ const command = args[0];
|
|
|
13
13
|
|
|
14
14
|
function printHelp() {
|
|
15
15
|
console.log(`
|
|
16
|
-
š agentctl v0.
|
|
16
|
+
š agentctl v0.21.0 ā Universal Agent Orchestrator & Safety Gatekeeper
|
|
17
17
|
|
|
18
18
|
Usage: agentctl <command> [options]
|
|
19
19
|
|
|
@@ -43,7 +43,7 @@ async function main() {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (command === "version" || command === "--version" || command === "-v") {
|
|
46
|
-
console.log("agentctl v0.
|
|
46
|
+
console.log("agentctl v0.21.0");
|
|
47
47
|
process.exit(0);
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -223,7 +223,7 @@ async function main() {
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
case "doctor": {
|
|
226
|
-
console.log(`\nš agentctl System Diagnostics (v0.
|
|
226
|
+
console.log(`\nš agentctl System Diagnostics (v0.21.0)`);
|
|
227
227
|
console.log(`--------------------------------------------------`);
|
|
228
228
|
console.log(` Project Root : ${root}`);
|
|
229
229
|
console.log(` Config File : ${config._file || "None (Using defaults)"}`);
|
package/bin/init.js
CHANGED
|
@@ -145,11 +145,26 @@ const rulesDir = path.join(agentDir, "rules");
|
|
|
145
145
|
const queueDir = path.join(agentDir, "jules-queue");
|
|
146
146
|
const completedQueueDir = path.join(queueDir, "completed");
|
|
147
147
|
const workflowsDir = path.join(agentDir, "workflows");
|
|
148
|
+
const promptsDir = path.join(agentDir, "prompts");
|
|
148
149
|
|
|
149
|
-
[agentDir, rulesDir, queueDir, completedQueueDir, workflowsDir].forEach((d) => {
|
|
150
|
+
[agentDir, rulesDir, queueDir, completedQueueDir, workflowsDir, promptsDir].forEach((d) => {
|
|
150
151
|
if (!fs.existsSync(d)) fs.mkdirSync(d, { recursive: true });
|
|
151
152
|
});
|
|
152
153
|
|
|
154
|
+
// Scaffold .agent/prompts files
|
|
155
|
+
const sourcePromptsDir = path.join(kitRoot, ".agent/prompts");
|
|
156
|
+
if (fs.existsSync(sourcePromptsDir)) {
|
|
157
|
+
const promptFiles = fs.readdirSync(sourcePromptsDir);
|
|
158
|
+
promptFiles.forEach((file) => {
|
|
159
|
+
const srcPrompt = path.join(sourcePromptsDir, file);
|
|
160
|
+
const destPrompt = path.join(promptsDir, file);
|
|
161
|
+
if (!fs.existsSync(destPrompt) || isForce) {
|
|
162
|
+
fs.copyFileSync(srcPrompt, destPrompt);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
console.log("ā
Created: .agent/prompts presets (Overseer, Bolt, Sentinel, Janitor, Task_Template)");
|
|
166
|
+
}
|
|
167
|
+
|
|
153
168
|
// Scaffold .agent/jules.yml
|
|
154
169
|
const yamlConfigPath = path.join(agentDir, "jules.yml");
|
|
155
170
|
if (!fs.existsSync(yamlConfigPath) || isForce) {
|