jules-orchestrator-kit 0.66.0 → 0.68.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/AGENTS.md +135 -0
- package/CHANGELOG.md +824 -0
- package/README.md +4 -3
- package/ROADMAP_V1.md +202 -0
- package/bin/agentctl.mjs +20 -1
- package/package.json +5 -2
- package/scripts/doc-sync-check.mjs +9 -0
- package/scripts/guard-reach-check.mjs +24 -0
- package/scripts/run-tests.mjs +18 -1
- package/src/engine.mjs +39 -2
- package/src/guard-policy.mjs +151 -0
- package/src/security.mjs +134 -38
- package/src/stack-detector.mjs +46 -1
package/AGENTS.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Google Jules Autonomous Worker Directives
|
|
2
|
+
|
|
3
|
+
These guidelines govern all automated coding tasks executed by Google Jules (`jules`) on `jules-orchestrator-kit`.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Triage Directive (When to use Jules)
|
|
8
|
+
|
|
9
|
+
Dispatch tasks to Jules when ALL of the following apply:
|
|
10
|
+
1. Scoped code change with a clear objective.
|
|
11
|
+
2. Mechanically verifiable via automated test/build commands (`npm test`).
|
|
12
|
+
3. Requires no interactive local debugging or visual UI tweaking.
|
|
13
|
+
4. Does NOT modify restricted files (`.github/`, deployment keys, or `.agent/jules.yml`).
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## 2. MCP Machine Directive & Read-Before-Write Invariants
|
|
18
|
+
|
|
19
|
+
```xml
|
|
20
|
+
<MCP_DIRECTIVE>
|
|
21
|
+
<system_state>HEADLESS_CI_MODE</system_state>
|
|
22
|
+
<strict_invariants>
|
|
23
|
+
<rule>1. ZERO RUNTIME DEPENDENCIES: You are STRICTLY FORBIDDEN from adding third-party npm dependencies. Use ONLY native Node.js built-in modules (node:fs, node:path, node:child_process, node:crypto, etc.).</rule>
|
|
24
|
+
<rule>2. READ-BEFORE-WRITE (ZERO HALLUCINATION): You are FORBIDDEN from guessing internal API signatures. Before editing, inspect exact symbol definitions.</rule>
|
|
25
|
+
<rule>3. CROSS-PLATFORM PATHS: Always normalize Windows backslashes (\) to POSIX slashes (/) when manipulating paths or glob matching.</rule>
|
|
26
|
+
<rule>4. VERIFICATION LOOP: After patching code, execute `npm test` and ensure 100% of tests pass cleanly with 0 errors.</rule>
|
|
27
|
+
<rule>5. ABORT CONDITION: On repeated unresolvable test failures (4+ attempts), output <status>ABORT_UNRESOLVABLE</status> and terminate immediately.</rule>
|
|
28
|
+
</strict_invariants>
|
|
29
|
+
</MCP_DIRECTIVE>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 3. Dynamic Command Resolution
|
|
35
|
+
|
|
36
|
+
Jules automatically infers test and build verification commands via `scripts/command-resolver.mjs`:
|
|
37
|
+
- `.agent/jules.yml` -> Custom user commands (`test_cmd`, `build_cmd`)
|
|
38
|
+
- `package.json` -> `testCmd: "npm test"` (or `"npm run lint && npm test"`), `buildCmd: "npm run build"`
|
|
39
|
+
- `Cargo.toml` -> `testCmd: "cargo test --workspace"`, `buildCmd: "cargo build"`
|
|
40
|
+
- `go.mod` -> `testCmd: "go test ./..."`, `buildCmd: "go build ./..."`
|
|
41
|
+
- `pyproject.toml` -> `testCmd: "pytest"`, `buildCmd: "python3 -m compileall -q ."`
|
|
42
|
+
- Workspace graphs (`turbo.json`, `pnpm-workspace.yaml`, `nx.json`) -> targeted affected package filters
|
|
43
|
+
|
|
44
|
+
### Canonical Operator Commands (authoritative)
|
|
45
|
+
|
|
46
|
+
Operations run **only** via `agentctl`; a `scripts/*.mjs` not in `package.json` is stale.
|
|
47
|
+
|
|
48
|
+
- Locks: `agentctl lock acquire <agent> <task_id> <file_path...>` (conflict exits `1` naming the holder) · `lock status` · `lock release <task_id>`.
|
|
49
|
+
- Verification Gates: `agentctl mutate` · `agentctl coverage` · `agentctl probe` · `agentctl perf` · `npm test 2>&1 | agentctl fix`.
|
|
50
|
+
- Learnings: `agentctl learning add "<trigger>" "<solution>"` — both args required; regenerates `.agent/SYSTEM_LEARNINGS.md`, never hand-edit it.
|
|
51
|
+
- Flaky tests: `agentctl flaky status|heal|reset` · Escalations: `agentctl escalate <session_id>|--status|--flush`.
|
|
52
|
+
- Prompt hydration: `agentctl hydrate [prompt]` · Self-audit: `npm run jules:audit` · Doc drift: `npm run jules:doc-sync`.
|
|
53
|
+
- Portability: `agentctl providers` · `agentctl profile [--set minimal|standard|max]` · `agentctl ci init`.
|
|
54
|
+
- Env vars take `AGENT_*` or `JULES_*`; the `JULES_*` spelling wins where both are set.
|
|
55
|
+
- Use `JULES_DRY_RUN=1` when exercising dispatch paths so no session is spent.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 4. Operational & Code Quality Directives
|
|
60
|
+
|
|
61
|
+
- **Read Before Write**: Inspect target files and surrounding symbol signatures before applying changes.
|
|
62
|
+
- **Minimal Interference**: Preserve existing function signatures, comments, and zero-dependency architecture.
|
|
63
|
+
- **Falsifiable Criteria**: Never use unfalsifiable goals ("utterly perfect", "complete refactor"). Define tasks with binary scoreable criteria (e.g. passing test counts, 0 lint errors, explicit hard-fails).
|
|
64
|
+
- **Carry Evidence with Claims**: "It works" means pasting terminal verification output. Exit code 0 alone proves only process survival; inspect outputs/artifacts to prove function.
|
|
65
|
+
- **No Test Weakening Rule**: Never make a test pass by deleting assertions, commenting out checks, or weakening requirements. Leave unmet requirements RED with clear fix rationale.
|
|
66
|
+
- **Explicit File Ownership**: Sequence parallel swarm agents with explicit non-overlapping file ownership to prevent concurrent drift.
|
|
67
|
+
- **No Token Bloat**: Exclude lockfiles, minified bundles, and binary assets from diff representations.
|
|
68
|
+
- **Rebase Before PR**: Fetch latest `main`, rebase onto `origin/main`, re-execute verification suite. If the resulting diff is empty, close/abort PR without pushing.
|
|
69
|
+
- **Diff Payload Governor**: API forcefully truncates diff payloads > 80 KB. Keep total diff payload under 75 KB (`git diff | wc -c`).
|
|
70
|
+
- **Exploration Budget Protocol**: For complex tasks, run 3 phases — (1) silent Discovery & Symbol Tracing (no code), (2) Oracle & Test Formulation, (3) Surgical Implementation & Verification. Raises Hit@5 from 33% to 57%.
|
|
71
|
+
- **Critic Agent Pre-Review**: Evaluate patches for edge-case failures, $O(n^2)$ regressions, unhandled parameters, and CLS before opening the PR. In test changes, prove deliberate mutations turn tests red.
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 5. System Prompting & Guardrail Best Practices
|
|
76
|
+
|
|
77
|
+
To maximize the ratio of mergeable PRs vs. failed or hallucinated sessions, adhere to the rules defined in `.agent/rules/jules-protocol.md`.
|
|
78
|
+
|
|
79
|
+
### Multi-Agent Coordination, Verification Gates & Web Envelopes
|
|
80
|
+
|
|
81
|
+
- **Task Envelope Premise Validator**: Validates paths, scope, and base freshness (`agentctl task create`).
|
|
82
|
+
- **Task Envelopes & Templates**: Pre-calibrated, stack-agnostic templates (`agentctl task template --list`): Web (CWV/WCAG/SEO/Playwright/i18n/AI-access), Hardening (dead-code, mutation, CI falsify, isolation, error-paths, security), Universal (`agent-dep-audit`, `agent-doc-drift`, `agent-config-audit`, `agent-api-contract`), Deep Think (`debug`, `feature`, `optimize`, `harden`).
|
|
83
|
+
- **Specialist Roles**: Eight personas in `.agent/prompts/` selected via `agentctl dispatch --role <name>`: `overseer`, `bolt`, `sentinel`, `janitor`, `a11y`, `scribe`, `spectator`, `alchemist`.
|
|
84
|
+
- **Stale-Base Gate Predicate**: Rejects PRs whose merge-base is > 25 commits behind `origin/main`.
|
|
85
|
+
- **Asset Integrity Gate**: Inspects assets (`.woff2`, `.png`, `.jpg`) to ensure error pages never land silently.
|
|
86
|
+
- **Edge-Runtime Import Guard**: Blocks unsupported native Node imports (`node:fs`, `node:child_process`) in Edge environments.
|
|
87
|
+
|
|
88
|
+
### Standard Jules Guardrails Footer
|
|
89
|
+
|
|
90
|
+
`agentctl task create` generates this from the repo's resolved scope (`buildGuardrailFooter`, `src/wizard-task.mjs`), so the protected-path line names this project's real manifests. Match its shape in hand-written dispatches:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
Read AGENTS.md and .agent/rules/jules-protocol.md BEFORE starting.
|
|
94
|
+
Follow all rules strictly.
|
|
95
|
+
|
|
96
|
+
TASK: <description>
|
|
97
|
+
|
|
98
|
+
HARD CONSTRAINTS:
|
|
99
|
+
- Do NOT modify these protected paths: <from `agentctl gate`; here: package.json, .github/**, .agent/rules/**>. Enforced in CI by Agent Scope Guard.
|
|
100
|
+
- Diff Payload Governor: Keep total diff payload under 75 KB (`git diff | wc -c`) to prevent API truncation (~80 KB limit).
|
|
101
|
+
- Falsifiable & Evidence-Based: Attach full terminal verification output to PR. Never weaken assertions or delete failing tests to force a pass.
|
|
102
|
+
- Declare Scope Deviations: If modifying files outside task bounds, explicitly state rationale in PR.
|
|
103
|
+
- Verify before finishing: Run full type-check, lint, and unit test suites.
|
|
104
|
+
- 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.
|
|
105
|
+
- Remove any scratch files you created for debugging before submitting. Do not delete files that are part of the project.
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## 6. Exit Code Registry & Remediation Matrix
|
|
111
|
+
|
|
112
|
+
Standardized across all automation entry points (`agentctl`, `jules-dispatch`, `jules-self-audit`, `jules-queue-runner`).
|
|
113
|
+
|
|
114
|
+
| Code | Meaning | Immediate remediation |
|
|
115
|
+
| :--- | :--- | :--- |
|
|
116
|
+
| `0` | Success — verification passed, PR opened. | Merge, or proceed to the next queue task. |
|
|
117
|
+
| `1` | Pre-dispatch / arg failure; prompt > `limits.promptKb` (50 KB). | Shorten the prompt or check flags via `agentctl doctor`. |
|
|
118
|
+
| `2` | API / network — HTTP 429, `FAILED_PRECONDITION` concurrency quota, timeout. | Exponential backoff; stagger swarm dispatches (`staggerMs: 1500`). |
|
|
119
|
+
| `3` | Scope violation — restricted path (`.github/`, command files, `.agent/rules/`), or a `strictTestLock` tamper verdict. | Drop protected files from the diff, or pass `--allow-protected` / label `allow-protected-paths`. |
|
|
120
|
+
| `4` | Verification failed; with `--fix`, OODA repair also exhausted. | Fix the stage the gate names — it prints stage, exit code and output. |
|
|
121
|
+
| `5` | Diff payload exceeds `limits.diffKb` (default **75 KB**). | Split into smaller scoped envelopes (`npm run jules:validate-envelope`). |
|
|
122
|
+
| `6` | Secret leak prevented — high-confidence key; the finding names file and line. | Scrub the credential from source **and revoke the leaked key immediately**. |
|
|
123
|
+
| `7` | Quota exhausted — `dailyTasks` cap (default 300) reached. | Wait for the rolling 24h budget window to open, or raise `dailyTasks` in `.agent/config.yml`. |
|
|
124
|
+
| `8` | Flaky quarantine — oscillation >= 0.40 (Wilson CI interior). | Fix the non-deterministic test; OODA repair is suppressed by design, not broken. |
|
|
125
|
+
| `188` | Offline network violation — unmocked outbound egress blocked in sandbox. | Run `npm install` locally and mock network calls in tests; do not treat as a test regression. |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 7. Release Protocol & Automated Versioning
|
|
130
|
+
|
|
131
|
+
Whenever bumping the version:
|
|
132
|
+
1. Add a `CHANGELOG.md` entry, then bump `package.json`.
|
|
133
|
+
2. Push `main` first — the pipeline refuses to release a commit CI has not verified.
|
|
134
|
+
3. Run `npm run release`. It blocks on tests, the doc-sync gate, and a green CI matrix for `HEAD` before tagging `v<version>`, pushing, and creating the GitHub Release via `gh release create`. `--skip-ci-check` only when `gh` is unavailable.
|
|
135
|
+
|