litclaude-ai 0.3.1 → 0.3.3
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/CHANGELOG.md +21 -0
- package/README.md +5 -5
- package/README_ko-KR.md +5 -5
- package/RELEASE_CHECKLIST.md +6 -6
- package/package.json +1 -1
- package/plugins/litclaude/.claude-plugin/plugin.json +1 -1
- package/plugins/litclaude/skills/git-master/SKILL.md +130 -0
- package/plugins/litclaude/skills/init-deep/SKILL.md +196 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.3 - 2026-06-14 — port the init-deep skill
|
|
4
|
+
|
|
5
|
+
- Add the `init-deep` skill (`plugins/litclaude/skills/init-deep/`), a Claude-adapted port of the
|
|
6
|
+
reference hierarchical AGENTS.md generator: discovery → score → generate → review, with dynamic
|
|
7
|
+
explore-subagent scaling, a weighted scoring matrix, AGENTS.md templates, and quality gates. All
|
|
8
|
+
reference orchestration/LSP calls are re-authored to Claude Code surfaces (`Agent`/`Task` background
|
|
9
|
+
subagents, the `LSP` tool, `Workflow` for parallel generation, `TodoWrite`) — no literal calls to
|
|
10
|
+
missing tools, no Codex/opencode tokens.
|
|
11
|
+
- Add `plans/litclaude-reference-parity-sdd.md`: a decision-complete SDD plan capturing the full
|
|
12
|
+
OmO-reference parity audit (all 11 shared skills + both auxiliary packs are byte-identical) and the
|
|
13
|
+
remaining portable ports (`init-deep` done; `visual-qa` and `lsp-setup` planned), plus a verified
|
|
14
|
+
deliberate-omission (N/A) registry. Allowlisted as a non-shipped doc-class file.
|
|
15
|
+
|
|
16
|
+
## 0.3.2 - 2026-06-14 — port the git-master skill
|
|
17
|
+
|
|
18
|
+
- Add the `git-master` skill (`plugins/litclaude/skills/git-master/`), a Claude-adapted port of the
|
|
19
|
+
reference git-history specialist: mode-gated COMMIT / REBASE / HISTORY / STATUS workflows, atomic
|
|
20
|
+
commit grouping with local message-style detection, `--force-with-lease` rebase safety, and
|
|
21
|
+
`git log -S/-G` / `blame` / `bisect` / `reflog` history investigation. Aligned with LitClaude's
|
|
22
|
+
publish boundary — no commit/push/history rewrite without explicit user authorization.
|
|
23
|
+
|
|
3
24
|
## 0.3.1 - 2026-06-14 — neon-HUD truecolor detection on Windows Terminal / WSL2
|
|
4
25
|
|
|
5
26
|
- Fix the `[🔥LITCLAUDE]` HUD falling back to flat 256-color magenta in Windows Terminal under WSL2.
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
<p align="center">
|
|
11
11
|
<img src="https://img.shields.io/badge/npm-litclaude--ai-cb3837" />
|
|
12
|
-
<img src="https://img.shields.io/badge/version-0.3.
|
|
12
|
+
<img src="https://img.shields.io/badge/version-0.3.3-2ea44f" />
|
|
13
13
|
<img src="https://img.shields.io/badge/Claude%20Code-plugin-blueviolet" />
|
|
14
14
|
<img src="https://img.shields.io/badge/license-MIT-blue" />
|
|
15
15
|
</p>
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
> `litclaude@litclaude-ai`, so normal `claude` launches can load the
|
|
23
23
|
> LitClaude skills and hooks without a long `--plugin-dir` command.
|
|
24
24
|
|
|
25
|
-
This checkout is prepared as `litclaude-ai@0.3.
|
|
25
|
+
This checkout is prepared as `litclaude-ai@0.3.3` for personal install
|
|
26
26
|
convenience. The repo can remain quiet; preparing npm package metadata here does
|
|
27
27
|
not imply public repo promotion, marketplace publication, or advertisement.
|
|
28
|
-
Future package releases still require explicit user approval. The v0.3.
|
|
28
|
+
Future package releases still require explicit user approval. The v0.3.3
|
|
29
29
|
release materials preserve the v0.2.2 Dynamic workflow hardening work, add the
|
|
30
30
|
lit-family vocab rename and neon HUD on top of v0.2.2, describe LitClaude in
|
|
31
31
|
its own terms, and do not claim that npm publication has completed.
|
|
@@ -93,7 +93,7 @@ directory, the normal install command works:
|
|
|
93
93
|
|
|
94
94
|
```bash
|
|
95
95
|
cd /tmp
|
|
96
|
-
npx --yes litclaude-ai@0.3.
|
|
96
|
+
npx --yes litclaude-ai@0.3.3 install
|
|
97
97
|
```
|
|
98
98
|
|
|
99
99
|
Validate the installed plugin:
|
|
@@ -106,7 +106,7 @@ The installer also sets Claude Code's `statusLine` command to the packaged
|
|
|
106
106
|
LitClaude HUD. A typical no-color render starts like:
|
|
107
107
|
|
|
108
108
|
```text
|
|
109
|
-
[🔥LITCLAUDE v0.3.
|
|
109
|
+
[🔥LITCLAUDE v0.3.3] | O4.8 │ ctx [▎░░] 9%/1000k │ 5h [▏░] 4% ↻2h15m │ 1w [▊░] 35% ↻3d6h │ git main +3 ✓
|
|
110
110
|
```
|
|
111
111
|
|
|
112
112
|
The `↻` suffix is a compact rate-limit reset countdown. It is separated from
|
package/README_ko-KR.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
</p>
|
|
10
10
|
<p align="center">
|
|
11
11
|
<img src="https://img.shields.io/badge/npm-litclaude--ai-cb3837" />
|
|
12
|
-
<img src="https://img.shields.io/badge/version-0.3.
|
|
12
|
+
<img src="https://img.shields.io/badge/version-0.3.3-2ea44f" />
|
|
13
13
|
<img src="https://img.shields.io/badge/Claude%20Code-plugin-blueviolet" />
|
|
14
14
|
<img src="https://img.shields.io/badge/license-MIT-blue" />
|
|
15
15
|
</p>
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
> 설치되므로, 매번 긴 `--plugin-dir` 없이 일반 `claude` 실행에서
|
|
27
27
|
> LitClaude skill과 hook을 불러올 수 있습니다.
|
|
28
28
|
|
|
29
|
-
현재 checkout은 `litclaude-ai@0.3.
|
|
29
|
+
현재 checkout은 `litclaude-ai@0.3.3` 배포 준비용으로 정리되어 있습니다. 목적은
|
|
30
30
|
다른 PC에서도 빠르게 설치하기 위한 개인용 package metadata를 갖추는 것입니다.
|
|
31
31
|
npm package metadata를 준비했다고 해서 홍보, 공개 저장소 운영, Claude
|
|
32
32
|
marketplace 등록을 의미하지는 않습니다. 새 버전 배포는 항상 별도의 명시적
|
|
33
|
-
승인 후에 진행합니다. v0.3.
|
|
33
|
+
승인 후에 진행합니다. v0.3.3 release material은 v0.2.2 Dynamic workflow
|
|
34
34
|
hardening을 보존하고, lit-family vocab rename과 neon HUD를 추가하며,
|
|
35
35
|
LitClaude 자체의 표현으로 정리되어 있습니다. npm publish가 완료됐다고
|
|
36
36
|
주장하지 않습니다.
|
|
@@ -98,7 +98,7 @@ checkout을 먼저 해석해서 `sh: litclaude-ai: command not found`로 실패
|
|
|
98
98
|
|
|
99
99
|
```bash
|
|
100
100
|
cd /tmp
|
|
101
|
-
npx --yes litclaude-ai@0.3.
|
|
101
|
+
npx --yes litclaude-ai@0.3.3 install
|
|
102
102
|
```
|
|
103
103
|
|
|
104
104
|
설치 상태를 확인합니다.
|
|
@@ -111,7 +111,7 @@ installer는 Claude Code의 `statusLine` command도 packaged LitClaude HUD로
|
|
|
111
111
|
설정합니다. 색상을 제거한 예시는 다음처럼 시작합니다.
|
|
112
112
|
|
|
113
113
|
```text
|
|
114
|
-
[🔥LITCLAUDE v0.3.
|
|
114
|
+
[🔥LITCLAUDE v0.3.3] | O4.8 │ ctx [▎░░] 9%/1000k │ 5h [▏░] 4% ↻2h15m │ 1w [▊░] 35% ↻3d6h │ git main +3 ✓
|
|
115
115
|
```
|
|
116
116
|
|
|
117
117
|
`↻` 표시는 rate-limit reset까지 남은 시간을 짧게 보여주는 countdown입니다.
|
package/RELEASE_CHECKLIST.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# LitClaude Release Checklist
|
|
2
2
|
|
|
3
|
-
Status: `litclaude-ai@0.3.
|
|
4
|
-
|
|
5
|
-
`package.json` is aligned to `0.3.
|
|
6
|
-
`plugins/litclaude/.claude-plugin/plugin.json` is aligned to `0.3.
|
|
3
|
+
Status: `litclaude-ai@0.3.3` is the current release candidate — ports the reference `init-deep` skill
|
|
4
|
+
(Claude-adapted hierarchical AGENTS.md generator) and lands the reference-parity SDD plan.
|
|
5
|
+
`package.json` is aligned to `0.3.3`, and
|
|
6
|
+
`plugins/litclaude/.claude-plugin/plugin.json` is aligned to `0.3.3`.
|
|
7
7
|
|
|
8
8
|
This release carries the v0.2.2 Dynamic workflow hardening surfaces:
|
|
9
9
|
`/dynamic-workflow`, `workflow-check --json`, native `/goal` fallback guidance,
|
|
@@ -52,8 +52,8 @@ No npm publication is required for this track.
|
|
|
52
52
|
Before requesting publication approval, confirm these artifacts from the current
|
|
53
53
|
checkout:
|
|
54
54
|
|
|
55
|
-
- `package.json` version is `0.3.
|
|
56
|
-
- `plugins/litclaude/.claude-plugin/plugin.json` version is `0.3.
|
|
55
|
+
- `package.json` version is `0.3.3`.
|
|
56
|
+
- `plugins/litclaude/.claude-plugin/plugin.json` version is `0.3.3`.
|
|
57
57
|
- `plugins/litclaude/commands/dynamic-workflow.md` documents subagent delegation.
|
|
58
58
|
- `node bin/litclaude-ai.js workflow-check --json` reports `status: pass`.
|
|
59
59
|
- `node bin/litclaude-ai.js workflow-check --json` reports
|
package/package.json
CHANGED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: git-master
|
|
3
|
+
description: "MUST USE whenever a task needs a commit or git-history investigation. Covers atomic commits, staging, commit-message style, rebase, squash, fixup/autosquash, blame, bisect, reflog, git log -S/-G, and questions like who wrote this or when was this added. Do not use for ordinary code edits unless the user asks for git work."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Git Master
|
|
7
|
+
|
|
8
|
+
The LitClaude git-history specialist for Claude Code. Use this skill when the user
|
|
9
|
+
asks you to operate on Git history or answer a Git-history question. Be exact,
|
|
10
|
+
conservative, and evidence-led. Read the repository state before you infer anything.
|
|
11
|
+
|
|
12
|
+
## LitClaude publish boundary
|
|
13
|
+
|
|
14
|
+
Commit, push, force-push, and history rewrites are outward-facing or hard-to-reverse
|
|
15
|
+
operations. Per LitClaude discipline, do **not** commit, push, force-push, reset,
|
|
16
|
+
stash-pop, or rewrite history unless the user explicitly authorized that exact
|
|
17
|
+
operation. Investigative requests report findings and stop.
|
|
18
|
+
|
|
19
|
+
## Mode Gate
|
|
20
|
+
|
|
21
|
+
Classify the request first:
|
|
22
|
+
|
|
23
|
+
- `COMMIT`: stage and commit local changes.
|
|
24
|
+
- `REBASE`: rebase, squash, fixup, autosquash, reorder, split, or otherwise rewrite branch history.
|
|
25
|
+
- `HISTORY`: answer when, where, who, why, or which commit changed something.
|
|
26
|
+
- `STATUS`: inspect branch, diff, or working-tree state without changing it.
|
|
27
|
+
|
|
28
|
+
If the request is only investigative, report findings and stop.
|
|
29
|
+
|
|
30
|
+
## Ground Truth
|
|
31
|
+
|
|
32
|
+
Gather independent facts first (these are read-only and safe to run in parallel):
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
git status --short
|
|
36
|
+
git diff --stat
|
|
37
|
+
git diff --staged --stat
|
|
38
|
+
git branch --show-current
|
|
39
|
+
git log -30 --oneline
|
|
40
|
+
git rev-parse --abbrev-ref @{upstream}
|
|
41
|
+
git merge-base HEAD origin/main
|
|
42
|
+
git merge-base HEAD origin/master
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Missing upstream or missing `main`/`master` is normal. Fall back to the best
|
|
46
|
+
available branch or report the missing fact. Never treat a failed lookup as proof.
|
|
47
|
+
|
|
48
|
+
## Commit Mode
|
|
49
|
+
|
|
50
|
+
Commit only the user's requested changes. Preserve unrelated dirty work.
|
|
51
|
+
|
|
52
|
+
1. Detect message style from recent history (`git log -30 --pretty=format:%s`). Use the
|
|
53
|
+
dominant local pattern, language, and casing. Do not default to Conventional
|
|
54
|
+
Commits unless the repo already uses them.
|
|
55
|
+
2. Inspect the full diff, not only filenames. Separate unrelated user edits from the
|
|
56
|
+
requested commit.
|
|
57
|
+
3. Build atomic groups by behavior, module, and revertability. Keep implementation and
|
|
58
|
+
its direct tests together.
|
|
59
|
+
4. Prefer multiple commits for unrelated concerns. A single commit is acceptable only
|
|
60
|
+
when the changed files form one indivisible behavior or the user explicitly asks for one.
|
|
61
|
+
5. Stage by path or hunk so each commit contains only its atomic group.
|
|
62
|
+
6. Before each commit, verify `git diff --staged --stat` and enough staged diff to prove
|
|
63
|
+
the group is right.
|
|
64
|
+
7. Commit with the detected style. After each commit, verify `git log -1 --oneline`.
|
|
65
|
+
|
|
66
|
+
Grouping rules:
|
|
67
|
+
|
|
68
|
+
- Split different features, modules, generated artifacts, config, docs, and test-only
|
|
69
|
+
changes unless they are inseparable.
|
|
70
|
+
- Keep generated files with the source change that produced them when omitting them
|
|
71
|
+
would leave the repo inconsistent.
|
|
72
|
+
- Never hide failing or unrelated changes inside a broad commit.
|
|
73
|
+
- Follow the user's git conventions (e.g. no AI/co-author attribution when the repo or
|
|
74
|
+
the user's rules forbid it).
|
|
75
|
+
|
|
76
|
+
Final report: list commit hashes, messages, and any remaining uncommitted files.
|
|
77
|
+
|
|
78
|
+
## Rebase Mode
|
|
79
|
+
|
|
80
|
+
History rewriting is a shared-impact operation.
|
|
81
|
+
|
|
82
|
+
- Never rebase or rewrite `main`, `master`, `dev`, release branches, or a protected
|
|
83
|
+
branch unless the user explicitly named that exact operation.
|
|
84
|
+
- If commits may already be pushed, ask before force-pushing. Use `--force-with-lease`,
|
|
85
|
+
never plain `--force`.
|
|
86
|
+
- If the worktree is dirty, preserve it intentionally before rebasing. Do not stash-pop
|
|
87
|
+
over conflicts without checking what changed.
|
|
88
|
+
- For fixups, prefer `git commit --fixup=<hash>` then
|
|
89
|
+
`GIT_SEQUENCE_EDITOR=: git rebase -i --autosquash <base>`.
|
|
90
|
+
- For conflicts, read the conflicting files and resolve by intent. Do not choose
|
|
91
|
+
ours/theirs blindly.
|
|
92
|
+
- If a rebase goes wrong, run `git rebase --abort` first. Use reflog only after
|
|
93
|
+
explaining the recovery path.
|
|
94
|
+
|
|
95
|
+
After rewriting, run the relevant tests or at least the project's cheapest smoke check,
|
|
96
|
+
then show the new branch log from base to HEAD.
|
|
97
|
+
|
|
98
|
+
## History Mode
|
|
99
|
+
|
|
100
|
+
Choose the Git tool by the question:
|
|
101
|
+
|
|
102
|
+
- `git log -S "text"`: when the count of an exact string changed.
|
|
103
|
+
- `git log -G "regex"`: when diffs touched lines matching a pattern.
|
|
104
|
+
- `git blame -L start,end -- file`: who last changed specific lines.
|
|
105
|
+
- `git log --follow -- file`: history across renames for one file.
|
|
106
|
+
- `git show <hash>`: inspect the commit that appears relevant.
|
|
107
|
+
- `git bisect`: find the first bad commit when there is a deterministic pass/fail
|
|
108
|
+
command and known good/bad bounds.
|
|
109
|
+
- `git reflog`: recover or explain recent local history movement.
|
|
110
|
+
|
|
111
|
+
Always cite the exact command evidence in the answer: commit hash, subject, file path,
|
|
112
|
+
and line or diff context when relevant. If the evidence is ambiguous, say what remains
|
|
113
|
+
unproven.
|
|
114
|
+
|
|
115
|
+
## Safety Checks
|
|
116
|
+
|
|
117
|
+
Before any write to Git history:
|
|
118
|
+
|
|
119
|
+
- Current branch is known.
|
|
120
|
+
- Dirty work is accounted for.
|
|
121
|
+
- Upstream/pushed status is known or explicitly unknown.
|
|
122
|
+
- The operation matches an explicit user request and authorization.
|
|
123
|
+
- Recovery path is known (`rebase --abort`, reflog hash, or untouched worktree).
|
|
124
|
+
|
|
125
|
+
Before finishing:
|
|
126
|
+
|
|
127
|
+
- Run the most relevant verification available for the changed behavior or history
|
|
128
|
+
operation (Manual QA evidence where a behavior changed).
|
|
129
|
+
- Report commands that passed and any command you could not run.
|
|
130
|
+
- Leave the worktree state explicit.
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: init-deep
|
|
3
|
+
description: "Initialize a hierarchical AGENTS.md knowledge base for a repository — a root AGENTS.md plus complexity-scored subdirectory files. Use when the user wants to bootstrap or refresh project knowledge for Claude Code, onboard a codebase, generate AGENTS.md/CLAUDE.md guidance, or map an unfamiliar repo. Adapted for the Claude Code host: discovery via background explore subagents + the LSP tool, parallel generation via Dynamic workflow."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Init-Deep — hierarchical AGENTS.md generator (Claude Code)
|
|
7
|
+
|
|
8
|
+
Generate hierarchical `AGENTS.md` files: a root knowledge base plus complexity-scored subdirectory
|
|
9
|
+
files. This is the LitClaude onboarding/knowledge-base skill, re-authored for Claude Code surfaces
|
|
10
|
+
(`Agent`/`Task` subagents, the `LSP` tool, `Workflow` for parallel generation, `TodoWrite`).
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
init-deep # Update mode: modify existing AGENTS.md + create new where warranted
|
|
16
|
+
init-deep --create-new # Read existing → remove all → regenerate from scratch
|
|
17
|
+
init-deep --max-depth=2 # Limit directory depth (default: 3)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Workflow (high level)
|
|
21
|
+
|
|
22
|
+
1. **Discovery + analysis** (concurrent) — background explore subagents + local bash structure + LSP
|
|
23
|
+
codemap + read existing AGENTS.md.
|
|
24
|
+
2. **Score & decide** — determine AGENTS.md locations from merged findings.
|
|
25
|
+
3. **Generate** — root first, then subdirectories in parallel.
|
|
26
|
+
4. **Review** — deduplicate, trim, validate.
|
|
27
|
+
|
|
28
|
+
Track all four phases with `TodoWrite` and flip each `pending → in_progress → completed` in real time.
|
|
29
|
+
|
|
30
|
+
## Phase 1 — Discovery + analysis (concurrent)
|
|
31
|
+
|
|
32
|
+
Mark "discovery" in_progress.
|
|
33
|
+
|
|
34
|
+
### Fire background explore subagents immediately
|
|
35
|
+
|
|
36
|
+
Spawn read-only explore subagents with the `Agent` tool (`subagent_type: "explore"`,
|
|
37
|
+
`run_in_background: true`) so they run while the main session works. Claude notifies you when each
|
|
38
|
+
finishes; collect their final messages before scoring. Launch independent agents in one message so
|
|
39
|
+
they run concurrently. Suggested lanes (one agent each):
|
|
40
|
+
|
|
41
|
+
- **Structure** — predict standard patterns for the detected language; report deviations only.
|
|
42
|
+
- **Entry points** — find main/entry files; report non-standard organization.
|
|
43
|
+
- **Conventions** — find config files (`.eslintrc`, `pyproject.toml`, `.editorconfig`, …); report
|
|
44
|
+
project-specific rules.
|
|
45
|
+
- **Anti-patterns** — find `DO NOT` / `NEVER` / `ALWAYS` / `DEPRECATED` markers; list forbidden patterns.
|
|
46
|
+
- **Build/CI** — find `.github/workflows`, `Makefile`, `Taskfile`; report non-standard patterns.
|
|
47
|
+
- **Tests** — find test configs and structure; report unique conventions.
|
|
48
|
+
|
|
49
|
+
**Dynamic subagent scaling** — after the bash pass below, spawn ADDITIONAL explore agents based on
|
|
50
|
+
project scale (never a static count):
|
|
51
|
+
|
|
52
|
+
| Factor | Threshold | Additional agents |
|
|
53
|
+
|--------|-----------|-------------------|
|
|
54
|
+
| Total files | >100 | +1 per 100 files |
|
|
55
|
+
| Total lines | >10k | +1 per 10k lines |
|
|
56
|
+
| Directory depth | ≥4 | +2 for deep exploration |
|
|
57
|
+
| Large files (>500 lines) | >10 files | +1 for complexity hotspots |
|
|
58
|
+
| Monorepo | detected | +1 per package/workspace |
|
|
59
|
+
| Multiple languages | >1 | +1 per language |
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
total_files=$(find . -type f -not -path '*/node_modules/*' -not -path '*/.git/*' | wc -l)
|
|
63
|
+
total_lines=$(find . -type f \( -name "*.ts" -o -name "*.py" -o -name "*.go" \) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | tail -1 | awk '{print $1}')
|
|
64
|
+
large_files=$(find . -type f \( -name "*.ts" -o -name "*.py" \) -not -path '*/node_modules/*' -exec wc -l {} + 2>/dev/null | awk '$1 > 500 {c++} END {print c+0}')
|
|
65
|
+
max_depth=$(find . -type d -not -path '*/node_modules/*' -not -path '*/.git/*' | awk -F/ '{print NF}' | sort -rn | head -1)
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
For very broad repos, run the discovery fan-out as a Dynamic workflow (call the `Workflow` tool when
|
|
69
|
+
Claude Code exposes it) instead of many manual `Agent` calls.
|
|
70
|
+
|
|
71
|
+
### Main session: concurrent local analysis
|
|
72
|
+
|
|
73
|
+
While background agents run, the main session does:
|
|
74
|
+
|
|
75
|
+
**1. Bash structural analysis**
|
|
76
|
+
```bash
|
|
77
|
+
# Directory depth distribution
|
|
78
|
+
find . -type d -not -path '*/.*' -not -path '*/node_modules/*' -not -path '*/dist/*' -not -path '*/build/*' | awk -F/ '{print NF-1}' | sort -n | uniq -c
|
|
79
|
+
# Files per directory (top 30)
|
|
80
|
+
find . -type f -not -path '*/.*' -not -path '*/node_modules/*' | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -30
|
|
81
|
+
# Existing knowledge bases
|
|
82
|
+
find . -type f \( -name "AGENTS.md" -o -name "CLAUDE.md" \) -not -path '*/node_modules/*' 2>/dev/null
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**2. Read existing AGENTS.md** — for each file found, `Read` it and extract key insights,
|
|
86
|
+
conventions, and anti-patterns into an EXISTING map. With `--create-new`, read ALL existing files
|
|
87
|
+
first (preserve context), THEN delete, THEN regenerate.
|
|
88
|
+
|
|
89
|
+
**3. LSP codemap (if available)** — use the Claude `LSP` tool: list configured servers, then request
|
|
90
|
+
document symbols for entry points and workspace symbols for `class` / `interface` / `function`, and
|
|
91
|
+
references for the top exports to gauge centrality. If no server is configured, fall back to the
|
|
92
|
+
explore subagents + plain search.
|
|
93
|
+
|
|
94
|
+
Merge bash + LSP + existing + explore findings. Mark "discovery" completed.
|
|
95
|
+
|
|
96
|
+
## Phase 2 — Scoring & location decision
|
|
97
|
+
|
|
98
|
+
Mark "scoring" in_progress.
|
|
99
|
+
|
|
100
|
+
### Scoring matrix
|
|
101
|
+
|
|
102
|
+
| Factor | Weight | High threshold | Source |
|
|
103
|
+
|--------|--------|----------------|--------|
|
|
104
|
+
| File count | 3× | >20 | bash |
|
|
105
|
+
| Subdir count | 2× | >5 | bash |
|
|
106
|
+
| Code ratio | 2× | >70% | bash |
|
|
107
|
+
| Unique patterns | 1× | has own config | explore |
|
|
108
|
+
| Module boundary | 2× | has `index.ts`/`__init__.py` | bash |
|
|
109
|
+
| Symbol density | 2× | >30 symbols | LSP |
|
|
110
|
+
| Export count | 2× | >10 exports | LSP |
|
|
111
|
+
| Reference centrality | 3× | >20 refs | LSP |
|
|
112
|
+
|
|
113
|
+
### Decision rules
|
|
114
|
+
|
|
115
|
+
| Score | Action |
|
|
116
|
+
|-------|--------|
|
|
117
|
+
| Root (`.`) | ALWAYS create |
|
|
118
|
+
| >15 | Create AGENTS.md |
|
|
119
|
+
| 8–15 | Create if it is a distinct domain |
|
|
120
|
+
| <8 | Skip (parent covers it) |
|
|
121
|
+
|
|
122
|
+
Mark "scoring" completed.
|
|
123
|
+
|
|
124
|
+
## Phase 3 — Generate AGENTS.md
|
|
125
|
+
|
|
126
|
+
Mark "generate" in_progress.
|
|
127
|
+
|
|
128
|
+
**File-writing rule:** if `AGENTS.md` already exists at the target path, use `Edit`; if not, use
|
|
129
|
+
`Write`. NEVER `Write` over an existing file — check existence first (via the discovery results or a
|
|
130
|
+
`Read`).
|
|
131
|
+
|
|
132
|
+
### Root AGENTS.md (full treatment)
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
# PROJECT KNOWLEDGE BASE
|
|
136
|
+
**Generated:** {TIMESTAMP} **Commit:** {SHORT_SHA} **Branch:** {BRANCH}
|
|
137
|
+
|
|
138
|
+
## OVERVIEW
|
|
139
|
+
{1–2 sentences: what + core stack}
|
|
140
|
+
|
|
141
|
+
## STRUCTURE
|
|
142
|
+
{tree with non-obvious purposes only}
|
|
143
|
+
|
|
144
|
+
## WHERE TO LOOK
|
|
145
|
+
| Task | Location | Notes |
|
|
146
|
+
|
|
147
|
+
## CODE MAP
|
|
148
|
+
{from LSP — skip if unavailable or project <10 files}
|
|
149
|
+
|
|
150
|
+
## CONVENTIONS
|
|
151
|
+
{ONLY deviations from standard}
|
|
152
|
+
|
|
153
|
+
## ANTI-PATTERNS (THIS PROJECT)
|
|
154
|
+
{explicitly forbidden here}
|
|
155
|
+
|
|
156
|
+
## COMMANDS
|
|
157
|
+
{dev / test / build}
|
|
158
|
+
|
|
159
|
+
## NOTES
|
|
160
|
+
{gotchas}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Quality gate: 50–150 lines, no generic advice, no obvious info.
|
|
164
|
+
|
|
165
|
+
### Subdirectory AGENTS.md (parallel)
|
|
166
|
+
|
|
167
|
+
Generate each non-root location in parallel — spawn one writing subagent per location with the `Agent`
|
|
168
|
+
tool, or run them as a Dynamic workflow. Each child gets a `TASK:` line plus `DELIVERABLE` (the
|
|
169
|
+
AGENTS.md), `SCOPE` (this directory only), and `VERIFY` (30–80 lines, never repeats parent content;
|
|
170
|
+
sections: OVERVIEW 1 line, STRUCTURE if >5 subdirs, WHERE TO LOOK, CONVENTIONS if different,
|
|
171
|
+
ANTI-PATTERNS). Wait for all. Mark "generate" completed.
|
|
172
|
+
|
|
173
|
+
## Phase 4 — Review & deduplicate
|
|
174
|
+
|
|
175
|
+
Mark "review" in_progress. For each generated file: remove generic advice, remove parent duplicates,
|
|
176
|
+
trim to the size limits, verify telegraphic style. Mark "review" completed.
|
|
177
|
+
|
|
178
|
+
## Final report
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
=== init-deep complete ===
|
|
182
|
+
Mode: {update | create-new}
|
|
183
|
+
Files: [OK] ./AGENTS.md (root, {N} lines) · [OK] ./src/hooks/AGENTS.md ({N} lines)
|
|
184
|
+
Dirs analyzed: {N} · Created: {N} · Updated: {N}
|
|
185
|
+
Hierarchy: ./AGENTS.md └── src/hooks/AGENTS.md
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Anti-patterns
|
|
189
|
+
|
|
190
|
+
- **Static agent count** — vary explore subagents by project size/depth (see the scaling table).
|
|
191
|
+
- **Sequential execution** — run explore + LSP concurrently; generate subdirectories in parallel.
|
|
192
|
+
- **Ignoring existing** — ALWAYS read existing AGENTS.md first, even with `--create-new`.
|
|
193
|
+
- **Over-documenting** — not every directory needs an AGENTS.md.
|
|
194
|
+
- **Redundancy** — a child file never repeats its parent.
|
|
195
|
+
- **Generic content** — remove anything that applies to all projects.
|
|
196
|
+
- **Verbose style** — telegraphic or die.
|