gm-skill 0.1.2 → 2.0.1080

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.
Files changed (85) hide show
  1. package/AGENTS.md +1 -0
  2. package/LICENSE +21 -0
  3. package/README.md +20 -84
  4. package/agents/gm.md +22 -0
  5. package/agents/memorize.md +100 -0
  6. package/agents/research-worker.md +36 -0
  7. package/agents/textprocessing.md +47 -0
  8. package/bin/bootstrap.js +702 -0
  9. package/bin/plugkit.js +136 -0
  10. package/bin/plugkit.sha256 +7 -0
  11. package/bin/plugkit.version +1 -0
  12. package/bin/plugkit.wasm +0 -0
  13. package/bin/plugkit.wasm.sha256 +1 -0
  14. package/bin/rtk.sha256 +6 -0
  15. package/bin/rtk.version +1 -0
  16. package/gm-plugkit/bootstrap.js +694 -0
  17. package/gm-plugkit/cli.js +48 -0
  18. package/gm-plugkit/index.js +12 -0
  19. package/gm-plugkit/package.json +26 -0
  20. package/gm-plugkit/plugkit-wasm-wrapper.js +190 -0
  21. package/gm-plugkit/plugkit.sha256 +6 -0
  22. package/gm-plugkit/plugkit.version +1 -0
  23. package/gm.json +27 -0
  24. package/lang/browser.js +45 -0
  25. package/lang/ssh.js +166 -0
  26. package/lib/browser-spool-handler.js +130 -0
  27. package/lib/browser.js +131 -0
  28. package/lib/codeinsight.js +109 -0
  29. package/lib/daemon-bootstrap.js +253 -132
  30. package/lib/git.js +0 -1
  31. package/lib/learning.js +169 -0
  32. package/lib/skill-bootstrap.js +406 -0
  33. package/lib/spool-dispatch.js +100 -0
  34. package/lib/spool.js +87 -49
  35. package/lib/wasm-host.js +241 -0
  36. package/package.json +38 -20
  37. package/prompts/bash-deny.txt +22 -0
  38. package/prompts/pre-compact.txt +21 -0
  39. package/prompts/prompt-submit.txt +83 -0
  40. package/prompts/session-start.txt +15 -0
  41. package/scripts/run-hook.sh +7 -0
  42. package/scripts/watch-cascade.js +166 -0
  43. package/skills/browser/SKILL.md +80 -0
  44. package/skills/code-search/SKILL.md +48 -0
  45. package/skills/create-lang-plugin/SKILL.md +121 -0
  46. package/skills/gm/SKILL.md +10 -49
  47. package/skills/gm-complete/SKILL.md +16 -87
  48. package/skills/gm-emit/SKILL.md +17 -50
  49. package/skills/gm-execute/SKILL.md +18 -69
  50. package/skills/gm-skill/SKILL.md +43 -0
  51. package/skills/gm-skill/index.js +21 -0
  52. package/skills/governance/SKILL.md +97 -0
  53. package/skills/pages/SKILL.md +208 -0
  54. package/skills/planning/SKILL.md +21 -97
  55. package/skills/research/SKILL.md +43 -0
  56. package/skills/ssh/SKILL.md +71 -0
  57. package/skills/textprocessing/SKILL.md +40 -0
  58. package/skills/update-docs/SKILL.md +24 -43
  59. package/gm-complete.SKILL.md +0 -106
  60. package/gm-emit.SKILL.md +0 -70
  61. package/gm-execute.SKILL.md +0 -88
  62. package/gm.SKILL.md +0 -63
  63. package/index.js +0 -1
  64. package/lib/index.js +0 -37
  65. package/lib/loader.js +0 -66
  66. package/lib/manifest.js +0 -99
  67. package/lib/prepare.js +0 -14
  68. package/planning.SKILL.md +0 -118
  69. package/skills/gm/index.js +0 -113
  70. package/skills/gm-complete/index.js +0 -118
  71. package/skills/gm-complete.SKILL.md +0 -106
  72. package/skills/gm-emit/index.js +0 -90
  73. package/skills/gm-emit.SKILL.md +0 -70
  74. package/skills/gm-execute/index.js +0 -91
  75. package/skills/gm-execute.SKILL.md +0 -88
  76. package/skills/gm.SKILL.md +0 -63
  77. package/skills/planning/index.js +0 -107
  78. package/skills/planning.SKILL.md +0 -118
  79. package/skills/update-docs/index.js +0 -108
  80. package/skills/update-docs.SKILL.md +0 -66
  81. package/test-build.js +0 -29
  82. package/test-e2e.js +0 -117
  83. package/test-unified.js +0 -24
  84. package/test.js +0 -89
  85. package/update-docs.SKILL.md +0 -66
package/AGENTS.md ADDED
@@ -0,0 +1 @@
1
+ # gm-skill
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,99 +1,35 @@
1
- # gm-skill
1
+ # gm-skill — Canonical Universal Harness
2
2
 
3
- Unified skill library for gm platform implementations.
3
+ The single canonical body of the gm skill-driven orchestration harness. All 15 platform-specific `gm-<platform>` packages re-export this surface; this is the source of truth.
4
4
 
5
- ## Installation
5
+ ## What this is
6
6
 
7
- ```bash
8
- npm install gm-skill
9
- ```
10
-
11
- ## Usage
12
-
13
- ### Daemon Bootstrap Functions
14
-
15
- ```javascript
16
- const {
17
- ensureRsLearningDaemonRunning,
18
- ensureRsCodeinsightDaemonRunning,
19
- ensureRsSearchDaemonRunning,
20
- ensureAcptoapiRunning,
21
- checkPortReachable
22
- } = require('gm-skill');
23
- ```
24
-
25
- #### Functions
26
-
27
- - `ensureRsLearningDaemonRunning()` - Ensures rs-learn daemon is running
28
- - `ensureRsCodeinsightDaemonRunning()` - Ensures rs-codeinsight daemon is running
29
- - `ensureRsSearchDaemonRunning()` - Ensures rs-search daemon is running
30
- - `ensureAcptoapiRunning()` - Ensures acptoapi daemon is running
31
- - `checkPortReachable(host, port, timeoutMs)` - Check if a port is reachable
7
+ AI-native software engineering orchestrated as a continuous chain — PLAN → EXECUTE → EMIT → VERIFY → UPDATE-DOCS — bootstrapped on top of `plugkit` for task execution and session isolation. Spool-driven, daemonize-by-default, end-to-end chained.
32
8
 
33
- All functions are async and return an object with `ok` and additional metadata.
34
-
35
- ### Spool Dispatch Helpers
36
-
37
- ```javascript
38
- const { spool } = require('gm-skill');
39
- const { writeSpool, readSpoolOutput, waitForCompletion, getAllOutputs } = spool;
40
- ```
9
+ ## Install
41
10
 
42
- #### Functions
43
-
44
- - `writeSpool(body, lang, options)` - Write code to spool input directory; returns `{ id, path, lang, ext }`
45
- - `body` (string) - Code to execute
46
- - `lang` (string, default: `'nodejs'`) - Language: nodejs, python, bash, typescript, go, rust, c, cpp, java, deno
47
- - `options` (object, optional) - `{ taskId, sessionId }`
48
- - `readSpoolOutput(id)` - Read completed task output; returns `{ id, stdout, stderr, metadata, exitCode, durationMs, timedOut }`
49
- - `waitForCompletion(id, timeoutMs)` - Poll for task completion; returns promise with `{ ok, ...output }`
50
- - `getAllOutputs()` - Enumerate all completed tasks in spool directory; returns array of output objects
51
-
52
- All paths are platform-aware (Windows and POSIX compatible).
53
-
54
- #### Example
55
-
56
- ```javascript
57
- const { spool } = require('gm-skill');
58
-
59
- const result = spool.writeSpool('console.log("hello")', 'nodejs');
60
- console.log(result.id);
61
-
62
- const output = await spool.waitForCompletion(result.id, 30000);
63
- console.log(output.stdout);
11
+ ```bash
12
+ npm install gm-skill
64
13
  ```
65
14
 
66
- ### Skill Manifests
15
+ Then point your AI coding agent host (Claude Code, OpenCode, Cursor, Zed, VS Code, Codex, Kilo, JetBrains, Copilot CLI, Hermes, etc.) at the included `skills/` directory, or invoke the bootstrap directly:
67
16
 
68
- ```javascript
69
- const { manifest } = require('gm-skill');
70
- const { getManifest, getSkill, getAllSkills } = manifest;
17
+ ```bash
18
+ npx gm-skill-bootstrap
71
19
  ```
72
20
 
73
- #### Functions
21
+ ## What's inside
74
22
 
75
- - `getManifest()` - Get full package manifest with all 4 core skills; returns `{ name, version, description, skills: [...] }`
76
- - `getSkill(name)` - Get individual skill manifest by name (gm, gm-execute, gm-emit, gm-complete); returns skill object with metadata
77
- - `getAllSkills()` - Get array of all 4 core skills with full metadata; returns `[{ name, description, allowedTools, compatiblePlatforms, endToEnd, skillMdContent }, ...]`
23
+ - `skills/` every shared skill (gm, gm-execute, gm-emit, gm-complete, planning, update-docs, browser, code-search, create-lang-plugin, governance, pages, research, ssh, textprocessing, gm-skill itself)
24
+ - `bin/bootstrap.js` plugkit downloader + daemon launcher
25
+ - `gm-plugkit/` spool watcher and WASM wrapper
26
+ - `lib/` — daemon-bootstrap, skill-bootstrap, spool-dispatch, git, codeinsight modules
27
+ - `agents/`, `prompts/`, `scripts/`, `lang/` — supporting surface
78
28
 
79
- Skill metadata includes:
80
- - `name` - Skill identifier
81
- - `description` - Human-readable skill purpose
82
- - `allowedTools` - Array of tool names the skill permits
83
- - `compatiblePlatforms` - Array of platforms this skill targets
84
- - `endToEnd` - Boolean flag indicating end-to-end skill vs helper
85
- - `skillMdContent` - Full SKILL.md file content
29
+ ## Version
86
30
 
87
- #### Example
31
+ `2.0.1080` — auto-bumped from the canonical `gm` repo. Every push to `AnEntrypoint/gm` republishes this package alongside all 15 platform packages.
88
32
 
89
- ```javascript
90
- const { manifest } = require('gm-skill');
33
+ ## Source of truth
91
34
 
92
- const allSkills = manifest.getAllSkills();
93
- allSkills.forEach(skill => {
94
- console.log(`${skill.name}: ${skill.description}`);
95
- });
96
-
97
- const gmSkill = manifest.getSkill('gm');
98
- console.log('Allowed tools:', gmSkill.allowedTools);
99
- ```
35
+ This package is generated from [AnEntrypoint/gm](https://github.com/AnEntrypoint/gm) — do not edit files in this repo directly; they will be overwritten on next publish.
package/agents/gm.md ADDED
@@ -0,0 +1,22 @@
1
+ ---
2
+ description: Agent (not skill) - immutable programming state machine. Always invoke for all work coordination.
3
+ mode: primary
4
+ ---
5
+
6
+ # GM — Skill-First Orchestrator
7
+
8
+ **Invoke the `planning` skill immediately.** Use the Skill tool with `skill: "planning"`.
9
+
10
+ **CRITICAL: Skills are invoked via the Skill tool ONLY. Do NOT use the Agent tool to load skills. Skills are not agents. Use: `Skill tool` with `skill: "gm"` (or `"planning"`, `"gm-execute"`, `"gm-emit"`, `"gm-complete"`, `"update-docs"`). Using the Agent tool for skills is a violation.**
11
+
12
+ All work coordination, planning, execution, and verification happens through the skill tree:
13
+ - `planning` skill → `gm-execute` skill → `gm-emit` skill → `gm-complete` skill → `update-docs` skill
14
+ - `memorize` sub-agent — background only, non-sequential. Invocation: `Agent(subagent_type='memorize', model='haiku', run_in_background=true, prompt='## CONTEXT TO MEMORIZE\n<what was learned>')`
15
+
16
+ All code execution uses `exec:<lang>` via the Bash tool — never direct `Bash(node ...)` or `Bash(npm ...)`.
17
+
18
+ To send stdin to a running background task: `exec:type` with task_id on line 1 and input on line 2.
19
+
20
+ Do not use `EnterPlanMode`. Do not run code directly via Bash. Invoke `planning` skill first.
21
+
22
+ Responses to the user must be two sentences maximum, only when the user needs to know something, and in plain conversational language — no file paths, filenames, symbols, or technical identifiers.
@@ -0,0 +1,100 @@
1
+ ---
2
+ name: memorize
3
+ description: Background memory agent. Classifies context and writes to AGENTS.md + rs-learn. No memory dir, no MEMORY.md.
4
+ ---
5
+
6
+ # Memorize — Background Memory Agent
7
+
8
+ Writes facts to two places only: **AGENTS.md** (non-obvious technical caveats) and **rs-learn** (all classified facts via fast ingest).
9
+
10
+ Resolve at start of every run:
11
+
12
+ - **Project root** = `process.cwd()` when invoked. `AGENTS.md` is `<project root>/AGENTS.md`.
13
+ - **Reach check** = run `gh api repos/<owner>/<repo> --jq .permissions.push` on `<project root>`'s `git remote get-url origin`. Cache the answer for the run. If the result is anything other than literal `true` (false, no remote, non-github URL, gh CLI missing, gh not authed, repo private and inaccessible), the project is **out-of-reach**.
14
+
15
+ ## STEP 0: SCOPE GUARD — DO NOT POLLUTE OUT-OF-REACH PROJECTS
16
+
17
+ If the reach check returns out-of-reach:
18
+
19
+ - **Do** ingest classified facts into rs-learn (Step 2) — rs-learn is per-user, not per-project, so private notes about a project the user is reading-but-not-owning are safe there.
20
+ - **Do not** read or edit `<project root>/AGENTS.md` (Step 3). Skip the file entirely.
21
+ - **Do not** run the AGENTS.md ↔ rs-learn migration audit (Step 4). The audit edits AGENTS.md.
22
+
23
+ Reason: agents running in a cwd that points at a third-party repo (e.g. running Claude inside a checkout of `nousresearch/hermes-agent` while building a downstream port) must not write project-specific notes into the upstream project's AGENTS.md. That AGENTS.md belongs to the upstream maintainers. Personal porting notes belong in the user's downstream repo's AGENTS.md, or — when the work spans multiple repos and there's no clean home — in rs-learn only.
24
+
25
+ When the reach check returns **in-reach**, proceed normally with all four steps below.
26
+
27
+ ## STEP 1: CLASSIFY
28
+
29
+ Examine the ## CONTEXT TO MEMORIZE section at the end of this prompt. For each fact, classify as:
30
+
31
+ - user: user role, goals, preferences, knowledge
32
+ - feedback: guidance on approach — corrections AND confirmations
33
+ - project: ongoing work, goals, bugs, incidents, decisions
34
+ - reference: pointers to external systems, URLs, paths
35
+
36
+ Discard:
37
+ - Obvious facts derivable from reading the code
38
+ - Active task state or session progress
39
+ - Facts that would not be useful in a future session
40
+
41
+ ## STEP 2: INGEST INTO RS-LEARN
42
+
43
+ For each classified fact, invoke `exec:memorize` (HTTP-preferred, subprocess fallback — fast either way):
44
+
45
+ ```
46
+ exec:memorize
47
+ <type>/<slug>
48
+ <fact body — one to three self-contained sentences>
49
+ ```
50
+
51
+ Line 1 of the body is the source tag (e.g. `feedback/terse-responses`, `project/merge-freeze`). Lines 2+ are the fact itself. Use kebab-case slugs.
52
+
53
+ A discipline sigil — `@<name>` as the first space-token in the invoking prompt, or a trailing `discipline=<name>` line — routes the write to that discipline's store. Without one, the write lands in the default store. Forward the sigil verbatim to `exec:memorize`; never invent or default a discipline name.
54
+
55
+ To invalidate previously-memorized content (correction or retraction):
56
+
57
+ ```
58
+ exec:forget
59
+ by-source <tag>
60
+ ```
61
+
62
+ Or by content:
63
+
64
+ ```
65
+ exec:forget
66
+ by-query <2-6 search words>
67
+ ```
68
+
69
+ **CRITICAL: rs-learn failures must be explicit and recoverable.** If `exec:memorize` fails (socket unavailable, network error, timeout):
70
+ 1. Report the failure to the user with error details
71
+ 2. Fallback immediately to STEP 3 (AGENTS.md) to preserve the fact in the always-on context buffer
72
+ 3. Never proceed as if the write succeeded
73
+ 4. This contract ensures memory preservation when the rs-learn retrieval store is temporarily unavailable
74
+
75
+ ## STEP 3: AGENTS.md
76
+
77
+ A non-obvious technical caveat qualifies if it required multiple failed runs to discover and would not be apparent from reading code or docs.
78
+
79
+ For each qualifying fact from context:
80
+ - Read AGENTS.md first if not already read this run
81
+ - If AGENTS.md already covers it → skip
82
+ - If genuinely non-obvious → append to the appropriate section
83
+
84
+ Never add: obvious patterns, active task progress, redundant restatements.
85
+
86
+ ## STEP 4: AGENTS.md → RS-LEARN MIGRATION (BENCHMARK + DRAIN)
87
+
88
+ AGENTS.md is the **always-on context buffer** — every prompt sees it. rs-learn is the **conditional retrieval store** — only relevant facts surface. The migration loop turns AGENTS.md into a benchmark for rs-learn's recall quality:
89
+
90
+ 1. Pick **5 random items** from AGENTS.md (sections, paragraphs, or numbered points). Don't pick the most recent additions — pick the oldest stable items.
91
+ 2. For each item, derive a 2-6 word query that a future agent would naturally use to find this fact.
92
+ 3. Run `exec:recall` with that query.
93
+ 4. Decide:
94
+ - **Recall accurate AND complete** → the rs-learn store has internalized this fact; **remove it from AGENTS.md**. Frees buffer space and confirms learning.
95
+ - **Recall partial / outdated / missing** → keep the AGENTS.md item AND ingest a refined version of the fact via `exec:memorize` so next round it can pass. Note the outcome in your run log.
96
+ 5. Report the audit cycle in the run output (items checked, removed, refined). Do not write the audit result to AGENTS.md — it is changelog-shaped and AGENTS.md forbids dated audit sections.
97
+
98
+ Why: AGENTS.md grows monotonically without this loop. rs-learn already filters by relevance per-prompt, so duplicating stable facts in AGENTS.md just inflates the always-on context. The migration drains AGENTS.md into the retrieval store as the store proves it can recall. Failed migrations leave the fact in AGENTS.md (safe default) and improve the store. Success rate over time = a metric for how well gm is learning this project.
99
+
100
+ Don't migrate if the fact is genuinely about agent meta-behavior that must be active every prompt (e.g. "always invoke gm:gm first") — those stay permanently.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: research-worker
3
+ description: Focused single-thread web investigator. Spawned in parallel by the research skill. Owns one question, returns one path.
4
+ agent: true
5
+ allowed-tools: WebFetch, WebSearch, Bash
6
+ ---
7
+
8
+ # Research Worker
9
+
10
+ One question. One context. One file on disk. One-line return.
11
+
12
+ Two shapes of brief arrive: a live-web question owning a path under `.gm/research/<slug>/<worker-id>.md`, or a corpus chunk owning `.gm/disciplines/<name>/corpus/concise/<chunk-id>.md`. The corpus shape carries an input chunk on disk and a fact-preservation contract — every claim, number, name, caveat, and citation from the source survives the rewrite; prose density rises, content does not shrink. No fetching unless the brief asks for it. The output file looks like the live-web one but the `Sources` section points at the input chunk path and any inline citations the chunk already carried.
13
+
14
+ ## Brief shape
15
+
16
+ The spawning prompt names: the question, the answer shape expected, the explicit out-of-scope boundary, and the destination path `.gm/research/<slug>/<worker-id>.md`. If any of those is missing or ambiguous, treat that as the first finding — record what was unclear and stop, rather than guessing scope.
17
+
18
+ ## Investigation
19
+
20
+ Open with a `WebSearch` broad enough to map sources, narrow enough to exclude obviously off-topic results. Pick the two or three highest-quality hits — primary docs, dated authored posts, RFCs, source repos — and `WebFetch` each. Aggregator pages, content farms, and undated listicles are last resort, flagged as such when used.
21
+
22
+ Stop fetching when the question is answered to the shape requested. Extra fetches past sufficiency burn tokens the orchestrator needs for synthesis.
23
+
24
+ ## Output
25
+
26
+ Write the findings file with: the question restated, the answer in the requested shape, every non-trivial claim followed by `[source: <url>]` and a quoted span, a `Sources` section listing every URL touched with a one-line quality note, and an `Unresolved` section naming anything the brief asked for that the search did not yield.
27
+
28
+ A claim without an inline source URL is a defect; remove it before writing the file.
29
+
30
+ ## Return
31
+
32
+ Return only: the absolute path to the findings file, and a single sentence summarising the headline answer. Never return the full findings inline — the orchestrator reads from disk.
33
+
34
+ ## Boundary
35
+
36
+ Do not chase tangents that surface mid-investigation, however interesting. Note them in `Unresolved` so the orchestrator can decide whether to fan out a new worker. Stretching past the brief is the worker-side equivalent of the orchestrator skipping fan-out.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: textprocessing
3
+ description: Haiku-backed text processor. Takes a body of text and an instruction, returns the processed output. The required surface for any task whose correctness depends on understanding (summary, classify, extract, rewrite, translate, semantic dedup, score, label).
4
+ agent: true
5
+ ---
6
+
7
+ # Textprocessing — Haiku Language Processor
8
+
9
+ The single surface for intelligent text transforms. Code does mechanics (count, split, regex, sort, dedup-by-equality); this agent does meaning (summary, classify, extract, rewrite, translate, semantic dedup, score, label).
10
+
11
+ ## INVOCATION
12
+
13
+ ```
14
+ Agent(subagent_type='gm:textprocessing', model='haiku', prompt='## INPUT\n<body>\n\n## INSTRUCTION\n<task>')
15
+ ```
16
+
17
+ `prompt` always carries both halves — input under `## INPUT`, instruction under `## INSTRUCTION`. The agent reads both, performs the transform, returns the result as plain text or JSON per what the instruction asked for. No preamble, no commentary, no "here is your output" wrapper.
18
+
19
+ ## OUTPUT CONTRACT
20
+
21
+ - Plain-text instruction → plain-text output, no fences, no labels.
22
+ - JSON instruction (e.g. "return as a JSON array of {id, label}") → exactly that JSON, parseable by `JSON.parse`, no fences, no surrounding prose.
23
+ - Multi-document input requested as a list → one entry per input doc in the same order, no skips.
24
+
25
+ If the instruction is ambiguous about the output shape, default to plain text. If the input is empty, return empty output (empty string or `[]` for JSON).
26
+
27
+ ## BATCH PATTERN
28
+
29
+ N independent items → N parallel `Agent(textprocessing)` calls in ONE message, each with its own item under `## INPUT`. Never serialize independent items. The runner collects results and assembles the batch.
30
+
31
+ For one large body that exceeds a single-prompt budget: the *caller* chunks the body deterministically (paragraph, section, fixed-token) and fans out one Agent call per chunk in parallel, then merges. The agent itself does not chunk; it processes whatever it receives in one shot.
32
+
33
+ ## DISCIPLINE
34
+
35
+ Code for mechanics, agent for meaning.
36
+
37
+ - Mechanics (use code): char/word/token count, byte length, split on delimiter, exact-string find/replace, regex match/extract, sort, group-by-key, dedup-by-equality, lowercase/uppercase, JSON parse/stringify, base64, URL encode.
38
+ - Meaning (use this agent): summarize, classify, extract entities/intents, rewrite for tone/audience, translate, semantic dedup (same meaning, different words), rank/score by quality, label by topic, decide if two texts are "about the same thing", paraphrase, simplify, expand outline → prose.
39
+
40
+ A loop in code that "checks if this string contains certain meaning" via keyword lists is a stub of this agent. Replace it with one Agent call (or N parallel ones) per item.
41
+
42
+ ## CONSTRAINTS
43
+
44
+ - Model is fixed at `haiku` — fast, cheap, sufficient for transform tasks. Escalate to opus only when the agent's haiku output fails an acceptance check, never preemptively.
45
+ - No tools beyond Read/Write — the agent processes text it receives, optionally reads/writes chunks for multi-pass jobs. Never spawns subagents.
46
+ - Background-spawnable: `run_in_background=true` for fire-and-forget batch processing where the caller polls results later.
47
+ - Idempotent: same input + same instruction → same output (modulo haiku sampling noise). Callers needing deterministic output specify `temperature=0` in the prompt.