@gonxped31/agent-kit 0.0.0-stage → 0.3.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.
@@ -0,0 +1,40 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "Bash(node .claude/skills/todo/scripts/todo.mjs:*)",
5
+ "Bash(node scripts/check.mjs:*)",
6
+ "Bash(node scripts/doctor.mjs:*)"
7
+ ],
8
+ "deny": [
9
+ "Read(./todos/**)",
10
+ "Edit(./todos/**)",
11
+ "Write(./todos/**)",
12
+ "Read(./todo-archive.md)",
13
+ "Edit(./todo-archive.md)",
14
+ "Write(./todo-archive.md)",
15
+ "Read(./*.log)"
16
+ ]
17
+ },
18
+ "hooks": {
19
+ "PreToolUse": [
20
+ {
21
+ "matcher": "Read",
22
+ "hooks": [
23
+ {
24
+ "type": "command",
25
+ "command": "node \"$CLAUDE_PROJECT_DIR/scripts/hooks/block-big-read.mjs\""
26
+ }
27
+ ]
28
+ },
29
+ {
30
+ "matcher": "Bash|PowerShell",
31
+ "hooks": [
32
+ {
33
+ "type": "command",
34
+ "command": "node \"$CLAUDE_PROJECT_DIR/scripts/hooks/guard-commands.mjs\""
35
+ }
36
+ ]
37
+ }
38
+ ]
39
+ }
40
+ }
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: agent-setup
3
+ description: Where agent knowledge goes (CLAUDE.md, skills, hooks, scripts, docs, todos) and its size limits. Use when adding or changing any of them, or after a repeated mistake.
4
+ ---
5
+
6
+ # Agent setup: where knowledge goes
7
+
8
+ ## 1. Pick the cheapest place that works
9
+
10
+ | The knowledge is... | Put it in | Costs |
11
+ | :--- | :--- | :--- |
12
+ | A rule a machine can check | A lint rule, a git hook (`.githooks/`), a permission in `.claude/settings.json`, or a Claude hook in `scripts/hooks/` | Nothing |
13
+ | Mechanical work done often | A script with short output: one line per problem, then OK or FAIL | Its output |
14
+ | True for every change | The root `CLAUDE.md` | Every turn |
15
+ | True for one folder | That folder's `CLAUDE.md` | When the agent works there |
16
+ | A procedure for one kind of task | A skill | Its description every session; the body when used |
17
+ | Long reference (specs, formulas, data formats) | `docs/`, listed in the root `CLAUDE.md`'s table | When read |
18
+ | Work for later, or for when something happens | A todo with its trigger (`todo` skill) | Nothing |
19
+ | Why a change was made | The commit message | Nothing |
20
+ | Your own habits, true in every repo | `~/.claude/CLAUDE.md` | Every turn, in every repo |
21
+
22
+ Prefer the top of the table. A written rule is a request; a check is a guarantee. When
23
+ a rule becomes a check, keep at most one line saying why.
24
+
25
+ ## 2. When to add something
26
+
27
+ - The same mistake twice: a rule. If a machine can check it: a check instead.
28
+ - The same procedure explained in two sessions: a skill.
29
+ - A command run often, with long output: a wrapper script.
30
+ - Not before. A guardrail for something that hasn't happened yet is a todo with a
31
+ trigger.
32
+
33
+ ## 3. Size limits
34
+
35
+ `node scripts/doctor.mjs` enforces them (`check` runs it).
36
+
37
+ | What | Limit |
38
+ | :--- | :--- |
39
+ | The root `CLAUDE.md` | 800 words |
40
+ | A folder's `CLAUDE.md` | 400 words |
41
+ | A skill's description | 30 words, saying when to use it ("Use when ...") |
42
+ | A `SKILL.md` | 100 lines; longer reference goes in files next to it |
43
+
44
+ Change a limit in `scripts/doctor.mjs` only with the reason in the commit.
45
+
46
+ ## 4. Adding a skill
47
+
48
+ 1. Look in `.claude/skills/` first: extend a skill rather than add a near-duplicate.
49
+ 2. Write `.claude/skills/<name>/SKILL.md` with frontmatter `name` (the folder's name)
50
+ and `description` (what it covers, then "Use when ..."). The body is procedure:
51
+ steps, commands, gotchas. No history, and nothing `CLAUDE.md` already says.
52
+ 3. A script goes in the skill's `scripts/` folder. Allow it in `.claude/settings.json`
53
+ (`Bash(node .claude/skills/<name>/scripts/<file>:*)`), merging into the list.
54
+ 4. Don't list skills in `CLAUDE.md`: their descriptions are already in context.
55
+ 5. Run `node scripts/doctor.mjs`.
56
+
57
+ ## 5. Never
58
+
59
+ - `@`-imports in `CLAUDE.md`: they load the whole file on every turn. Name the path in
60
+ backticks instead, so it's read only when needed.
61
+ - The same fact in two places. Point to its source (the code, a doc) instead of
62
+ copying it: copies go stale.
63
+
64
+ ## 6. The kit's files
65
+
66
+ agent-kit wrote the files listed in `.claude/agk.json`; change them as the repo needs.
67
+ `agk update` brings in the kit's later changes. Where the repo changed a file, it puts
68
+ the kit's version next to it as `<file>.kit`: merge what's new into the file, keeping
69
+ the repo's changes, then delete the `.kit` file (`doctor` reports it until then).
70
+
71
+ To reuse this repo's setup in new repos, the user can save it as a preset:
72
+ `agk preset save <name> --list` shows what it has beyond the kit. Help them pick what's
73
+ generic, then `--only <numbers>`.
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: git
3
+ description: Branching, committing, rebasing and merging. Use when starting a task, committing, or merging into main. One branch per task, files staged by name, main only with approval.
4
+ ---
5
+
6
+ # Git: a branch per task, main only with approval
7
+
8
+ `main` moves only through `node scripts/merge.mjs`, after the user approves. The
9
+ pre-commit hook refuses commits on `main` and runs `node scripts/check.mjs --fast`. A
10
+ Claude hook refuses `--no-verify` and bulk staging, and asks before merges, pushes and
11
+ commands that discard work.
12
+
13
+ ## 1. Start every task on a new branch
14
+
15
+ - `git switch -c <branch> main`. Names are short kebab-case `<area>-<topic>`, with the
16
+ todo ID first when there is one (`t-k7q3-route-cost`).
17
+ - Follow-ups to the same task stay on its branch.
18
+ - If the checkout is on a branch that isn't yours, or has changes you didn't make,
19
+ don't switch it. Work in a worktree in a sibling folder:
20
+ `git worktree add ../<repo>-<branch> -b <branch> main`.
21
+ - A worktree has no installed dependencies: install them there. Never link them
22
+ from the main checkout: removing the worktree deletes what the link points to.
23
+
24
+ ## 2. Commit
25
+
26
+ 1. `git branch --show-current` must print your branch. If it doesn't, someone switched
27
+ the checkout: stop and tell the user.
28
+ 2. `git status --short`, then stage what you changed **by name**. Leave out files you
29
+ didn't touch, and mention them.
30
+ 3. One logical change per commit. Todo changes go in the same commit as the work.
31
+ 4. If the hook fails, fix what it reports. Never get around it.
32
+
33
+ Message:
34
+
35
+ <Area>: <what is now true, or what changed> (T-xxxx)
36
+
37
+ Why it was needed, and what a reader can't see in the diff.
38
+ Say what wasn't verified, when that matters.
39
+
40
+ ## 3. Stay on top of main
41
+
42
+ After each commit: `git rebase main`. On a conflict, resolve it if both sides' intent
43
+ is clear, rerun `node scripts/check.mjs`, then `git rebase --continue`. Otherwise
44
+ `git rebase --abort` and ask.
45
+
46
+ ## 4. Merge into main: only with approval
47
+
48
+ 1. The branch is rebased onto `main`, and `node scripts/check.mjs` passes.
49
+ 2. Ask the user, stating the branch, its commits (`git log --oneline main..HEAD`) and
50
+ the checks run.
51
+ 3. Once approved, from the branch's checkout: `node scripts/merge.mjs <branch>`. It
52
+ refuses unless the tree is clean, the branch is on top of `main` and the checks
53
+ pass. Then it fast-forwards `main` and deletes the branch. From a worktree, it
54
+ prints how to remove the worktree instead.
55
+
56
+ ## With a remote
57
+
58
+ Only if `git remote` prints one:
59
+ - Branch from and rebase onto `origin/main`, after a `git fetch`.
60
+ - Push your branch after each rebase: `git push -u origin <branch>` the first time,
61
+ then `git push --force-with-lease` (your branch only, never `main`).
62
+ - After a merge, push `main` once the user agrees: `git push origin main`.
63
+
64
+ ## Never, without asking
65
+
66
+ - `reset --hard`, `clean`, `checkout -- <file>`, `restore <file>`, `stash drop`,
67
+ `branch -D`. Undo committed work with `git revert`.
68
+ - Rewrite `main` or force-push it.
@@ -0,0 +1,74 @@
1
+ ---
2
+ name: todo
3
+ description: The work queue, kept by a script. Use when working on, adding or reviewing todos, on "next todo", or when work must wait for a trigger.
4
+ ---
5
+
6
+ # Todos: the queue, through its script
7
+
8
+ `todos/` and `todo-archive.md` are the script's data. **Never read or edit them
9
+ directly** (the settings deny it): go through the script, so the queue costs almost no
10
+ tokens.
11
+
12
+ ## 1. Commands
13
+
14
+ `T` stands for `node .claude/skills/todo/scripts/todo.mjs`, run from the repo root.
15
+
16
+ | Command | What it does |
17
+ | :--- | :--- |
18
+ | `T next` | The best eligible item as its raw line, or `none` |
19
+ | `T list [-p N] [--tag X] [--all]` | Eligible items; `--all` adds blocked ones, marked `*` |
20
+ | `T show T-XXX` | The item's line, then its detail text if any |
21
+ | `T add "text" [-p 1-3] [--dep T-A,T-B] [--size S\|M\|L] [--tag a,b]` | Creates an item; prints only the new ID |
22
+ | `T set T-XXX [-p 1-3] [--dep T-A,T-B\|-] [--size S\|M\|L\|-]` | Changes priority, deps or size |
23
+ | `T edit T-XXX "new text"` | Replaces the one-line description |
24
+ | `T tag T-XXX a,b` | Replaces the tags (`-` clears them) |
25
+ | `T detail T-XXX 'text'` or `--file path` (`-`: stdin) [`--append`] | Sets the detail text (replaces it unless `--append`) |
26
+ | `T done T-XXX` | Archives it; prints `unblocked: ...` for items it freed |
27
+ | `T rm T-XXX` | Removes it without archiving (obsolete) |
28
+ | `T stats`, `T graph`, `T html [--out file]` | Counts, dependency tree, an HTML board |
29
+
30
+ Line format: `ID | P | dep | size | tags | description`.
31
+
32
+ - **Deps**: one ID, several comma-separated, or `-`. An item is eligible once none of
33
+ its deps are still open. Cycles are refused.
34
+ - **IDs** are random, `T-` plus 4 characters (`T-k7q3`), never reused. Typing them is
35
+ case-insensitive.
36
+ - **Tags**: lowercase, comma-separated, `-` for none. Use the project's own areas
37
+ (`setup`, `ui`, `data`...).
38
+ - **Detail text** is deleted with the item by `done` and `rm`; the archive keeps only
39
+ the line. Put anything worth keeping in the code or the commit.
40
+ - `next` picks the lowest P, then the oldest item.
41
+ - Output is plain when piped, which is how Claude gets it: don't pass color flags.
42
+ - **Quote text with single quotes.** Inside double quotes, Bash runs text between
43
+ backticks as a command, and PowerShell drops the backticks. For text with an
44
+ apostrophe, send it on stdin: `T detail <ID> --file - <<'EOF'`, the text, then `EOF`
45
+ (Bash); in PowerShell, write each apostrophe twice inside single quotes.
46
+
47
+ ## 2. Working a todo
48
+
49
+ 1. `T next`, then `T show <id>` if it may have detail text.
50
+ 2. If its size is L, or the description is vague, outline a plan and confirm it with
51
+ the user before editing.
52
+ 3. Do the work, focused on that one todo.
53
+ 4. `T done <id>`.
54
+ 5. `T add ...` for any follow-up work found, instead of growing the task.
55
+ 6. Report in 1-2 sentences, then stop. Don't start the next todo unless the user asked
56
+ for a batch.
57
+
58
+ ## 3. Deferred work
59
+
60
+ Work that waits on something ("when X ships, do Y") is a todo, not a note in chat:
61
+
62
+ T add '<what>' --tag <area>
63
+ T detail <ID> 'Trigger: <X>. Do: <Y>. Why: <reason>.'
64
+
65
+ The detail must stand alone: whoever picks it up won't have this conversation. Before
66
+ finishing any task, `T list --all` and look for todos the work just triggered.
67
+
68
+ ## 4. Parallel worktrees
69
+
70
+ The queue is built for several agents in their own worktrees. Each todo is its own file
71
+ and IDs need no shared counter, so branches that touch different todos merge cleanly.
72
+ `todo-archive.md` only grows, and `.gitattributes` merges it with `merge=union`, so
73
+ both branches' `done` lines stay. The same todo changed on both sides is a real
74
+ conflict: keep the right version by hand.