@gcunharodrigues/wrxn 0.7.3 → 0.8.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/manifest.json
CHANGED
|
@@ -343,6 +343,16 @@
|
|
|
343
343
|
"class": "managed",
|
|
344
344
|
"profile": "project"
|
|
345
345
|
},
|
|
346
|
+
{
|
|
347
|
+
"path": ".claude/skills/write-an-agent/SKILL.md",
|
|
348
|
+
"class": "managed",
|
|
349
|
+
"profile": "project"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"path": ".claude/skills/write-an-agent/EXAMPLES.md",
|
|
353
|
+
"class": "managed",
|
|
354
|
+
"profile": "project"
|
|
355
|
+
},
|
|
346
356
|
{
|
|
347
357
|
"path": ".claude/skills/audit/SKILL.md",
|
|
348
358
|
"class": "managed",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gcunharodrigues/wrxn",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "WRXN Kernel — installable AI operating system. Two profiles (project | workspace), pull-based updates, managed/seeded/state file classes.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"wrxn": "bin/wrxn.cjs"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# write-an-agent — Examples
|
|
2
|
+
|
|
3
|
+
## A compressed read-only locator
|
|
4
|
+
|
|
5
|
+
A canonical interactive subagent: a single job, a least-privilege grant (read-only — no `Bash`, so no
|
|
6
|
+
push path), `haiku` (the work is mechanical), and a tight output contract with a concrete example.
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
---
|
|
10
|
+
name: route-finder
|
|
11
|
+
description: >
|
|
12
|
+
Read-only locator for HTTP routes. Returns a path:line table of where each route
|
|
13
|
+
is defined and its handler. Use PROACTIVELY when someone asks "where is the X
|
|
14
|
+
route", "what handles the Y endpoint", or "list all routes".
|
|
15
|
+
tools: Read, Grep, Glob
|
|
16
|
+
model: haiku
|
|
17
|
+
---
|
|
18
|
+
You locate HTTP routes and report them. Nothing else.
|
|
19
|
+
|
|
20
|
+
## Process
|
|
21
|
+
1. Grep for route definitions (router calls, decorators, path strings).
|
|
22
|
+
2. Resolve each route's handler symbol.
|
|
23
|
+
3. Emit the table. Stop.
|
|
24
|
+
|
|
25
|
+
## Constraints
|
|
26
|
+
- Read-only — never edit, run git, or propose changes.
|
|
27
|
+
- No preamble, no prose padding.
|
|
28
|
+
|
|
29
|
+
## Output
|
|
30
|
+
Your final message IS the result. One row per route, nothing else:
|
|
31
|
+
`METHOD /path — handler@file:line`
|
|
32
|
+
Example:
|
|
33
|
+
`GET /users — listUsers@api/users.ts:42`
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Why it's SOTA:** read-only grant (no push path), `haiku` (mechanical), the `description` leads
|
|
37
|
+
delegation with "use PROACTIVELY" + exact trigger phrases, and the output contract is a fixed
|
|
38
|
+
one-row-per-route shape — the caller gets a compact table, not prose.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: write-an-agent
|
|
3
|
+
description: Create a state-of-the-art interactive Claude Code subagent (.claude/agents/<name>.md) through a guided interview — pin its single job, routing trigger, least-privilege tools (you approve the grant), model, and a mandatory compressed output contract, then scaffold and validate the subagent file. Use when someone wants to create, add, or scaffold a subagent, build a custom agent, or says "write an agent", "create an agent", or "new subagent".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Writing an Agent
|
|
7
|
+
|
|
8
|
+
Scaffold an **interactive subagent** — a `.claude/agents/<name>.md` file spawned via the Agent/Task
|
|
9
|
+
tool — through a short interview that gets the few SOTA levers right. Your job here is not to fill a
|
|
10
|
+
template; it is to **interrogate the job until the subagent is sharp, cheap, and safe**, then write a
|
|
11
|
+
validated file.
|
|
12
|
+
|
|
13
|
+
**Scope:** interactive helpers (locators, reviewers, runners you call in-session). **Not** AFK
|
|
14
|
+
pipeline executors — those live in the kernel's dispatch-executor registry (`wrxn dispatch`). If the
|
|
15
|
+
user wants a workflow *they* follow inline, write a skill instead (`write-a-skill`).
|
|
16
|
+
|
|
17
|
+
## Why a subagent (the levers that make it good)
|
|
18
|
+
|
|
19
|
+
A subagent is a **separate context** with its own tools, model, and system prompt. The caller sees
|
|
20
|
+
**only its final message**. That one fact drives every lever:
|
|
21
|
+
|
|
22
|
+
| Lever | Why |
|
|
23
|
+
|---|---|
|
|
24
|
+
| **Single responsibility** | One narrow job → sharp prompt → correct routing. An "and" means two subagents. |
|
|
25
|
+
| **`description` = #1 routing lever** | The main thread matches this text to delegate. Vague → mis-routed. Use "use PROACTIVELY" + trigger phrases. |
|
|
26
|
+
| **Least-privilege `tools`** | Omitting `tools` inherits ALL tools. Smaller surface = safer + cheaper. |
|
|
27
|
+
| **Compressed output contract** | The caller eats only the final message. A terse fixed shape is the highest-value, most-skipped lever. |
|
|
28
|
+
| **Stateless** | No memory but the spawn prompt + this file. Put everything it needs on the page. |
|
|
29
|
+
| **Model match** | Mechanical → haiku; reasoning → sonnet; hard → opus. |
|
|
30
|
+
|
|
31
|
+
## File format (verified — code.claude.com/docs sub-agents)
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
---
|
|
35
|
+
name: <kebab-case, equals the filename>
|
|
36
|
+
description: >
|
|
37
|
+
<what it does> + WHEN. Include "use PROACTIVELY" + trigger phrases.
|
|
38
|
+
tools: Read, Grep, Glob # explicit allowlist ALWAYS — omitting inherits ALL tools
|
|
39
|
+
model: haiku # haiku | sonnet | opus | inherit
|
|
40
|
+
skills: tdd # OPTIONAL — preloads that skill's content at startup
|
|
41
|
+
---
|
|
42
|
+
<system prompt — SOTA body order below>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Real fields: `name`, `description`, `tools`, `model`, `skills` (advanced: `disallowedTools`,
|
|
46
|
+
`permissionMode`). Don't invent others.
|
|
47
|
+
|
|
48
|
+
## Interview — run in this order
|
|
49
|
+
|
|
50
|
+
1. **Job** — the ONE responsibility. If it needs an "and", STOP and propose two subagents.
|
|
51
|
+
2. **Trigger** — when should the main thread delegate? → becomes `description`:
|
|
52
|
+
`<what it does>. Use PROACTIVELY when <the exact situations/phrases that route to it>.`
|
|
53
|
+
3. **Propose frontmatter → ONE consolidated approval.** Infer from the job, then show `tools` +
|
|
54
|
+
`model` + `skills` together as a single preview; the operator approves or edits before you continue:
|
|
55
|
+
- **tools** — the minimal allowlist. Locator/reviewer → `Read, Grep, Glob`; + run things → `+Bash`;
|
|
56
|
+
mutates files → `+Edit, Write`; research → `WebFetch, WebSearch`; integration →
|
|
57
|
+
`mcp__<server>__<tool>` (named, never `*`). **Never omit** (= inherit-all). **Never grant a push
|
|
58
|
+
path** (no devops). Flag `Bash` as broad (reaches `git` + the network).
|
|
59
|
+
- **model** — mechanical → `haiku`, reasoning → `sonnet`, hard → `opus`, match the caller → `inherit`.
|
|
60
|
+
- **skills** — propose only if the job maps to a skill **installed here** (`.claude/skills/<name>/`
|
|
61
|
+
exists; a dangling preload = a broken subagent). Don't auto-add `caveman` — compression ships via
|
|
62
|
+
the body instruction, which is portable.
|
|
63
|
+
4. **Output contract (mandatory)** — pin exactly what returns + how terse: a fixed return shape (e.g.
|
|
64
|
+
`path:line — finding`, one per line; or small JSON) **and** a compression instruction (lead with the
|
|
65
|
+
answer, drop prose, backtick exact paths/symbols). Don't finish the subagent without it.
|
|
66
|
+
5. **Generate → validate → write** (below).
|
|
67
|
+
|
|
68
|
+
## Body structure (SOTA order — every subagent)
|
|
69
|
+
|
|
70
|
+
1. **Role** — one line: who it is + the single job.
|
|
71
|
+
2. **Process** — the numbered steps it follows.
|
|
72
|
+
3. **Constraints** — hard NOs: what it refuses (scope creep; edits if read-only; ever pushing).
|
|
73
|
+
4. **Output contract** — the fixed return shape + **one concrete example**. State plainly: *your final
|
|
74
|
+
message IS the return value — return the result, not a conversational reply.* Compress.
|
|
75
|
+
5. **Stateless reminder** — it gets only its spawn prompt + this file; no main-thread memory, no
|
|
76
|
+
inherited CLAUDE.md persona. Keep the page self-sufficient.
|
|
77
|
+
|
|
78
|
+
## Validate (loose by design)
|
|
79
|
+
|
|
80
|
+
- [ ] `---` fences open/close; `name` present, kebab-case, equals the filename.
|
|
81
|
+
- [ ] `description` says **what** + **when** (the routing trigger; uses "use PROACTIVELY").
|
|
82
|
+
- [ ] `tools` is an explicit allowlist of **real** tools; present, never omitted; no push path.
|
|
83
|
+
- [ ] `model` ∈ `haiku | sonnet | opus | inherit`.
|
|
84
|
+
- [ ] `skills` (if present) names a skill that exists under `.claude/skills/`.
|
|
85
|
+
- [ ] Body has Role + Process + Constraints + Output contract (with an example).
|
|
86
|
+
- Don't hard-gate `tools` against a frozen list — new MCP tools are valid.
|
|
87
|
+
|
|
88
|
+
## Write + load
|
|
89
|
+
|
|
90
|
+
- Write `.claude/agents/<name>.md` at the install root. **Brownfield-safe**: if it exists, STOP —
|
|
91
|
+
offer to edit or rename, never overwrite.
|
|
92
|
+
- **Loading:** a file written to disk is **not live this session**. Tell the operator to **restart
|
|
93
|
+
Claude Code, or create/refresh it via the `/agents` interface** (which loads immediately). Then it is
|
|
94
|
+
invokable by the Agent/Task tool, a workflow, or FleetView.
|
|
95
|
+
|
|
96
|
+
See **[EXAMPLES.md](EXAMPLES.md)** for a complete worked subagent.
|