clikit-plugin 0.2.47 → 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.
- package/AGENTS.md +8 -5
- package/README.md +11 -9
- package/command/pr.md +20 -10
- package/command/ship.md +24 -16
- package/command/status.md +1 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/config.d.ts +7 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/tilth-reading.d.ts +68 -0
- package/dist/hooks/tilth-reading.d.ts.map +1 -0
- package/dist/hooks/tilth-reading.test.d.ts +2 -0
- package/dist/hooks/tilth-reading.test.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +128 -0
- package/memory/_templates/plan.md +3 -2
- package/package.json +2 -2
- package/skill/finishing-a-development-branch/SKILL.md +29 -27
- package/skill/ritual-workflow/SKILL.md +1 -1
- package/skill/tilth-reading/SKILL.md +110 -0
- package/skill/tilth-reading/references/fallback-flow.md +123 -0
- package/skill/using-git-worktrees/SKILL.md +32 -30
- package/src/agents/AGENTS.md +14 -0
- package/src/agents/build.md +38 -41
- package/src/agents/explore.md +21 -3
- package/src/agents/oracle.md +9 -5
package/dist/index.js
CHANGED
|
@@ -16267,6 +16267,11 @@ var DEFAULT_CONFIG = {
|
|
|
16267
16267
|
active_only: true,
|
|
16268
16268
|
ready_limit: 3,
|
|
16269
16269
|
log: false
|
|
16270
|
+
},
|
|
16271
|
+
tilth_reading: {
|
|
16272
|
+
enabled: true,
|
|
16273
|
+
min_content_length: 1000,
|
|
16274
|
+
log: false
|
|
16270
16275
|
}
|
|
16271
16276
|
}
|
|
16272
16277
|
};
|
|
@@ -17401,6 +17406,108 @@ function getBeadsCompactionContext(projectDirectory, config2) {
|
|
|
17401
17406
|
].join(`
|
|
17402
17407
|
`);
|
|
17403
17408
|
}
|
|
17409
|
+
// src/hooks/tilth-reading.ts
|
|
17410
|
+
var DEFAULT_MIN_CONTENT_LENGTH = 1000;
|
|
17411
|
+
var tilthAvailabilityCache = null;
|
|
17412
|
+
function isTilthAvailable() {
|
|
17413
|
+
if (tilthAvailabilityCache !== null)
|
|
17414
|
+
return tilthAvailabilityCache;
|
|
17415
|
+
try {
|
|
17416
|
+
const result = Bun.spawnSync(["tilth", "--version"], {
|
|
17417
|
+
stdout: "pipe",
|
|
17418
|
+
stderr: "pipe"
|
|
17419
|
+
});
|
|
17420
|
+
tilthAvailabilityCache = result.exitCode === 0;
|
|
17421
|
+
} catch {
|
|
17422
|
+
tilthAvailabilityCache = false;
|
|
17423
|
+
}
|
|
17424
|
+
return tilthAvailabilityCache;
|
|
17425
|
+
}
|
|
17426
|
+
function shouldAttemptTilthForTool(toolName, toolInput) {
|
|
17427
|
+
const normalized = toolName.toLowerCase();
|
|
17428
|
+
if (!normalized.includes("read"))
|
|
17429
|
+
return false;
|
|
17430
|
+
const path9 = extractFilePath(toolInput);
|
|
17431
|
+
return typeof path9 === "string" && path9.length > 0;
|
|
17432
|
+
}
|
|
17433
|
+
function extractFilePath(toolInput) {
|
|
17434
|
+
for (const key of ["filePath", "file_path", "path", "file"]) {
|
|
17435
|
+
const v = toolInput[key];
|
|
17436
|
+
if (typeof v === "string" && v.length > 0)
|
|
17437
|
+
return v;
|
|
17438
|
+
}
|
|
17439
|
+
return null;
|
|
17440
|
+
}
|
|
17441
|
+
function runTilth(filePath) {
|
|
17442
|
+
const result = Bun.spawnSync(["tilth", filePath], {
|
|
17443
|
+
stdout: "pipe",
|
|
17444
|
+
stderr: "pipe"
|
|
17445
|
+
});
|
|
17446
|
+
if (result.exitCode !== 0) {
|
|
17447
|
+
const stderr = result.stderr ? new TextDecoder().decode(result.stderr).trim() : "";
|
|
17448
|
+
throw new Error(`tilth exited ${result.exitCode}: ${stderr}`);
|
|
17449
|
+
}
|
|
17450
|
+
return new TextDecoder().decode(result.stdout);
|
|
17451
|
+
}
|
|
17452
|
+
function applyTilthReading(filePath, original, config2) {
|
|
17453
|
+
const minLen = config2?.min_content_length ?? DEFAULT_MIN_CONTENT_LENGTH;
|
|
17454
|
+
if (original.length < minLen) {
|
|
17455
|
+
return {
|
|
17456
|
+
usedTilth: false,
|
|
17457
|
+
tilthAvailable: false,
|
|
17458
|
+
content: original,
|
|
17459
|
+
outcome: "skipped"
|
|
17460
|
+
};
|
|
17461
|
+
}
|
|
17462
|
+
if (!isTilthAvailable()) {
|
|
17463
|
+
return {
|
|
17464
|
+
usedTilth: false,
|
|
17465
|
+
tilthAvailable: false,
|
|
17466
|
+
content: original,
|
|
17467
|
+
outcome: "tilth_unavailable"
|
|
17468
|
+
};
|
|
17469
|
+
}
|
|
17470
|
+
try {
|
|
17471
|
+
const enhanced = runTilth(filePath);
|
|
17472
|
+
if (!enhanced || enhanced.trim().length === 0) {
|
|
17473
|
+
return {
|
|
17474
|
+
usedTilth: false,
|
|
17475
|
+
tilthAvailable: true,
|
|
17476
|
+
content: original,
|
|
17477
|
+
outcome: "tilth_error",
|
|
17478
|
+
error: "tilth returned empty output"
|
|
17479
|
+
};
|
|
17480
|
+
}
|
|
17481
|
+
return {
|
|
17482
|
+
usedTilth: true,
|
|
17483
|
+
tilthAvailable: true,
|
|
17484
|
+
content: enhanced,
|
|
17485
|
+
outcome: "tilth_success"
|
|
17486
|
+
};
|
|
17487
|
+
} catch (err) {
|
|
17488
|
+
return {
|
|
17489
|
+
usedTilth: false,
|
|
17490
|
+
tilthAvailable: true,
|
|
17491
|
+
content: original,
|
|
17492
|
+
outcome: "tilth_error",
|
|
17493
|
+
error: err instanceof Error ? err.message : String(err)
|
|
17494
|
+
};
|
|
17495
|
+
}
|
|
17496
|
+
}
|
|
17497
|
+
function formatTilthLog(result, filePath) {
|
|
17498
|
+
switch (result.outcome) {
|
|
17499
|
+
case "tilth_success":
|
|
17500
|
+
return `[CliKit:tilth-reading] Enhanced read via tilth: ${filePath}`;
|
|
17501
|
+
case "tilth_unavailable":
|
|
17502
|
+
return `[CliKit:tilth-reading] tilth not available, using read output: ${filePath}`;
|
|
17503
|
+
case "tilth_error":
|
|
17504
|
+
return `[CliKit:tilth-reading] tilth error (fallback to read): ${filePath} \u2014 ${result.error ?? "unknown error"}`;
|
|
17505
|
+
case "skipped":
|
|
17506
|
+
return `[CliKit:tilth-reading] Skipped (content below threshold): ${filePath}`;
|
|
17507
|
+
default:
|
|
17508
|
+
return `[CliKit:tilth-reading] ${result.outcome}: ${filePath}`;
|
|
17509
|
+
}
|
|
17510
|
+
}
|
|
17404
17511
|
// src/tools/cass-memory.ts
|
|
17405
17512
|
import { execFile as execFile2 } from "child_process";
|
|
17406
17513
|
import { promisify as promisify2 } from "util";
|
|
@@ -18452,6 +18559,27 @@ ${(content || "").trim()}`.trim();
|
|
|
18452
18559
|
await hookErr("empty-message-sanitizer", error45, { tool: toolName });
|
|
18453
18560
|
}
|
|
18454
18561
|
}
|
|
18562
|
+
if (pluginConfig.hooks?.tilth_reading?.enabled !== false) {
|
|
18563
|
+
try {
|
|
18564
|
+
const tilthConfig = pluginConfig.hooks?.tilth_reading;
|
|
18565
|
+
const toolInput2 = getToolInput(input.args);
|
|
18566
|
+
if (shouldAttemptTilthForTool(toolName, toolInput2)) {
|
|
18567
|
+
const filePath = extractFilePath(toolInput2);
|
|
18568
|
+
if (filePath) {
|
|
18569
|
+
const result = applyTilthReading(filePath, toolOutputContent, tilthConfig);
|
|
18570
|
+
if (result.usedTilth) {
|
|
18571
|
+
toolOutputContent = result.content;
|
|
18572
|
+
output.output = result.content;
|
|
18573
|
+
}
|
|
18574
|
+
if (tilthConfig?.log === true) {
|
|
18575
|
+
await cliLog("info", formatTilthLog(result, filePath));
|
|
18576
|
+
}
|
|
18577
|
+
}
|
|
18578
|
+
}
|
|
18579
|
+
} catch (error45) {
|
|
18580
|
+
await hookErr("tilth-reading", error45, { tool: toolName });
|
|
18581
|
+
}
|
|
18582
|
+
}
|
|
18455
18583
|
if (pluginConfig.hooks?.truncator?.enabled !== false) {
|
|
18456
18584
|
try {
|
|
18457
18585
|
if (shouldTruncate(toolOutputContent, pluginConfig.hooks?.truncator)) {
|
|
@@ -116,12 +116,13 @@ Use this template when creating implementation plans.
|
|
|
116
116
|
|
|
117
117
|
## Execution Model
|
|
118
118
|
|
|
119
|
-
- Workflow quick mode: `/create → /start → /
|
|
120
|
-
- Workflow deep mode: `/create → /research → /design → /start → /
|
|
119
|
+
- Workflow quick mode: `/create → /start → /verify → /ship`
|
|
120
|
+
- Workflow deep mode: `/create → /research → /design → /start → /verify → /ship`
|
|
121
121
|
- Execution unit: **Task Packet**
|
|
122
122
|
- Source of truth: **Beads**
|
|
123
123
|
- `/start`: execute + per-packet verify loop
|
|
124
124
|
- `/verify`: pre-ship gate (all 4 checks, SHIP_READY verdict required before `/ship`)
|
|
125
|
+
- `/ship`: commit + sync/push landed changes in the shared checkout; `/pr` is an explicit exception path
|
|
125
126
|
|
|
126
127
|
---
|
|
127
128
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clikit-plugin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "OpenCode plugin — 7 agents, 15 commands, 22 skills, 10 hooks",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -67,4 +67,4 @@
|
|
|
67
67
|
"peerDependencies": {
|
|
68
68
|
"bun": ">=1.0.0"
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: finishing-a-development-branch
|
|
3
|
-
description:
|
|
3
|
+
description: Legacy compatibility skill. Finish work from the shared default-branch workspace: verify, sync, and land without worktrees or task branches.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Finishing a
|
|
6
|
+
# Finishing a Shared Workspace Session
|
|
7
|
+
|
|
8
|
+
> Legacy skill name: `finishing-a-development-branch`
|
|
7
9
|
|
|
8
10
|
## Step 1 — Verify
|
|
9
11
|
|
|
@@ -13,41 +15,41 @@ npm test # or project test command
|
|
|
13
15
|
|
|
14
16
|
**If tests fail: STOP. Fix first. Never proceed with failing tests.**
|
|
15
17
|
|
|
16
|
-
## Step 2 —
|
|
18
|
+
## Step 2 — Confirm shared-workspace state
|
|
17
19
|
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
2. PR — create pull request, keep branch
|
|
22
|
-
3. KEEP — push branch, continue later
|
|
23
|
-
4. DISCARD — delete branch and all changes
|
|
20
|
+
```bash
|
|
21
|
+
git branch --show-current # expect: repo default branch (main/master/etc.)
|
|
22
|
+
git status --short --branch # confirm only intended changes are present
|
|
24
23
|
```
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
If the branch is not the repo default branch, stop unless the user explicitly approved that branch.
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
## Step 3 — Present Options
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
Shared workspace on the default branch is ready. Choose:
|
|
31
|
+
1. LAND — sync default branch, push, keep working from shared checkout
|
|
32
|
+
2. PAUSE — leave local state in place and hand off
|
|
33
|
+
3. DISCARD — revert local changes and return to a clean checkout
|
|
33
34
|
```
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
## Step 4 — Execute
|
|
37
|
+
|
|
38
|
+
**LAND**
|
|
36
39
|
```bash
|
|
37
|
-
git
|
|
38
|
-
|
|
40
|
+
git pull --rebase
|
|
41
|
+
git push
|
|
39
42
|
```
|
|
40
43
|
|
|
41
|
-
**
|
|
44
|
+
**PAUSE**
|
|
42
45
|
```bash
|
|
43
|
-
|
|
44
|
-
# leave
|
|
46
|
+
/handoff
|
|
47
|
+
# leave shared workspace state intact for the next session
|
|
45
48
|
```
|
|
46
49
|
|
|
47
50
|
**DISCARD** — require typed confirmation: `"discard"`
|
|
48
51
|
```bash
|
|
49
|
-
git
|
|
50
|
-
git branch -D <branch> && git worktree remove <path>
|
|
52
|
+
git restore --worktree --staged .
|
|
51
53
|
```
|
|
52
54
|
|
|
53
55
|
## Safety Rules
|
|
@@ -56,11 +58,11 @@ git branch -D <branch> && git worktree remove <path>
|
|
|
56
58
|
|------|-------------|
|
|
57
59
|
| Tests must pass | Block on failure |
|
|
58
60
|
| DISCARD | Require typed `"discard"` to confirm |
|
|
59
|
-
| Force push to
|
|
60
|
-
|
|
|
61
|
+
| Force push to default branch | Never |
|
|
62
|
+
| Shared workspace drift | Sync and inspect before landing |
|
|
61
63
|
|
|
62
64
|
## Red Flags
|
|
63
65
|
|
|
64
|
-
-
|
|
66
|
+
- Landing without test verification
|
|
65
67
|
- Discarding without confirmation
|
|
66
|
-
-
|
|
68
|
+
- Creating a worktree or task branch just to finish the task
|
|
@@ -17,7 +17,7 @@ DISCOVER → PLAN → IMPLEMENT → VERIFY → COMPLETE
|
|
|
17
17
|
| PLAN | User approves spec + plan |
|
|
18
18
|
| IMPLEMENT | All planned tasks checked off |
|
|
19
19
|
| VERIFY | typecheck + tests + lint + build all pass |
|
|
20
|
-
| COMPLETE |
|
|
20
|
+
| COMPLETE | Changes landed on default branch / deployed |
|
|
21
21
|
|
|
22
22
|
## Command Map
|
|
23
23
|
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tilth-reading
|
|
3
|
+
description: Use when reading files, exploring codebases, or searching content. Tries tilth first for smart outline/section-aware reading; falls back to glob → read → grep if tilth is unavailable or fails.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tilth-first Reading
|
|
7
|
+
|
|
8
|
+
When any task requires reading files or exploring a codebase, follow this priority chain — always try the higher-priority tool first, fall back only when blocked.
|
|
9
|
+
|
|
10
|
+
## Priority Chain
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
1. tilth → smart, outline-aware, section-targeted reading
|
|
14
|
+
2. read → raw file content (fallback for full-file needs)
|
|
15
|
+
3. glob → fallback when you need to discover file paths
|
|
16
|
+
4. grep → fallback when you need to search content patterns
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
### Step 1 — Try tilth (always first)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Read a whole file (smart: outline or full depending on size)
|
|
25
|
+
tilth <path>
|
|
26
|
+
|
|
27
|
+
# Read a specific section by line range
|
|
28
|
+
tilth <path> --section 45-89
|
|
29
|
+
|
|
30
|
+
# Read a specific section by markdown heading
|
|
31
|
+
tilth <path> --section "## Installation"
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Tilth is available if:** `npx tilth --version` exits 0, or a local `tilth` binary is on PATH.
|
|
35
|
+
|
|
36
|
+
**When tilth succeeds:** use its output directly. Do not duplicate with `read`.
|
|
37
|
+
|
|
38
|
+
**When tilth fails or is unavailable:** immediately fall back — do not retry tilth for the same path.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
### Step 2 — Fallback: read (full file content)
|
|
43
|
+
|
|
44
|
+
Use when you need complete, unprocessed file content and tilth is not available.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
read <path>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Use `read` with `offset` + `limit` to scope large files:
|
|
51
|
+
```
|
|
52
|
+
read <path> offset=<line> limit=<n>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
### Step 3 — Fallback: glob (file discovery)
|
|
58
|
+
|
|
59
|
+
Use when you need to find files by pattern before reading.
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
glob pattern="**/*.ts" path="<dir>"
|
|
63
|
+
glob pattern="**/SKILL.md"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Always narrow the pattern as much as possible — avoid `**/*` without extension filtering.
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
### Step 4 — Fallback: grep (content search)
|
|
71
|
+
|
|
72
|
+
Use when you need to find symbols, usages, or patterns across files.
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
grep pattern="<regex>" include="*.ts" path="<dir>"
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Combine with `glob` results when searching a pre-discovered set of files.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Decision Table
|
|
83
|
+
|
|
84
|
+
| Need | Tool |
|
|
85
|
+
|------|------|
|
|
86
|
+
| Read a known file, outline/section | `tilth` |
|
|
87
|
+
| Read a known file, need full raw content | `tilth` → `read` |
|
|
88
|
+
| Find files matching a name/extension pattern | `tilth` → `glob` |
|
|
89
|
+
| Search for a symbol/pattern across files | `tilth` → `grep` |
|
|
90
|
+
| tilth unavailable or errored | `read` + `glob` + `grep` as needed |
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Fallback Rules
|
|
95
|
+
|
|
96
|
+
- **Never use `read` + `tilth` for the same path** — pick one.
|
|
97
|
+
- **Never use `glob` when you already know the path** — call `read`/`tilth` directly.
|
|
98
|
+
- **Never call `grep` for something `tilth --section` can already isolate.**
|
|
99
|
+
- **Log fallback reason** when possible (e.g. "tilth not found, using read").
|
|
100
|
+
|
|
101
|
+
## Red Flags
|
|
102
|
+
|
|
103
|
+
- Calling `read` on a large file (>500 lines) without first trying `tilth` — tilth's outline mode saves context.
|
|
104
|
+
- Using `grep` to extract a known section — use `tilth --section` instead.
|
|
105
|
+
- Ignoring tilth exit code and retrying without fallback.
|
|
106
|
+
- Calling `glob` to discover a path you already know.
|
|
107
|
+
|
|
108
|
+
## References
|
|
109
|
+
|
|
110
|
+
- [Fallback flow detail](references/fallback-flow.md) — full decision tree, tilth availability check, error codes
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Tilth-reading: Fallback Flow Reference
|
|
2
|
+
|
|
3
|
+
Full decision tree for the tilth-reading skill, including availability checks, error codes, and fallback triggers.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Availability Check
|
|
8
|
+
|
|
9
|
+
Before using tilth in a new session, verify it is available:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Option A: local install
|
|
13
|
+
tilth --version
|
|
14
|
+
|
|
15
|
+
# Option B: via npx
|
|
16
|
+
npx tilth --version
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
| Exit code | Meaning | Action |
|
|
20
|
+
|-----------|---------|--------|
|
|
21
|
+
| 0 | tilth available | Proceed with tilth |
|
|
22
|
+
| 1 / non-zero | tilth error | Fall back immediately |
|
|
23
|
+
| command not found | not installed | Fall back immediately |
|
|
24
|
+
|
|
25
|
+
> Cache the availability result within a session — do not re-check on every file read.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Full Decision Tree
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Need to read / search files?
|
|
33
|
+
│
|
|
34
|
+
├─► tilth available?
|
|
35
|
+
│ │
|
|
36
|
+
│ ├─► YES
|
|
37
|
+
│ │ │
|
|
38
|
+
│ │ ├─► Known path + section target?
|
|
39
|
+
│ │ │ └─► tilth <path> --section "…"
|
|
40
|
+
│ │ │
|
|
41
|
+
│ │ ├─► Known path, want smart summary/outline?
|
|
42
|
+
│ │ │ └─► tilth <path>
|
|
43
|
+
│ │ │
|
|
44
|
+
│ │ ├─► Need to discover paths first?
|
|
45
|
+
│ │ │ └─► glob → then tilth <each-path>
|
|
46
|
+
│ │ │
|
|
47
|
+
│ │ └─► Need to find symbol/pattern?
|
|
48
|
+
│ │ └─► tilth <path> --section <heading>
|
|
49
|
+
│ │ (or grep if heading unknown)
|
|
50
|
+
│ │
|
|
51
|
+
│ └─► NO / tilth errored
|
|
52
|
+
│ │
|
|
53
|
+
│ ├─► Need raw full file? → read <path>
|
|
54
|
+
│ ├─► Need file discovery? → glob pattern="…"
|
|
55
|
+
│ └─► Need pattern search? → grep pattern="…"
|
|
56
|
+
│
|
|
57
|
+
└─► Combine fallbacks as needed:
|
|
58
|
+
glob (discover) → read (content) → grep (pattern)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Error Codes from tilth
|
|
64
|
+
|
|
65
|
+
| Error | Cause | Fallback |
|
|
66
|
+
|-------|-------|---------|
|
|
67
|
+
| Binary file detected | file is not text | `read` (confirms binary) or skip |
|
|
68
|
+
| Generated file skipped | auto-generated file | proceed, check `read` if needed |
|
|
69
|
+
| File too large (>500KB) | outline only mode triggered | use tilth output (outline) or `read` with `offset`+`limit` |
|
|
70
|
+
| Non-zero exit, stderr | any runtime error | fall back to `read` + `grep` |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Tilth Flags Reference
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
tilth <path> # smart read: full or outline based on size
|
|
78
|
+
tilth <path> --section 45-89 # line range
|
|
79
|
+
tilth <path> --section "## Heading" # markdown heading
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Key internal thresholds (from tilth source):
|
|
83
|
+
- `TOKEN_THRESHOLD = 6000` — above this, tilth switches to outline mode
|
|
84
|
+
- `FILE_SIZE_CAP = 500_000 bytes` — above this, outline only
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Fallback Chain Examples
|
|
89
|
+
|
|
90
|
+
### Example 1: Explore an unfamiliar directory
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
1. glob pattern="src/**/*.ts" # discover files
|
|
94
|
+
2. tilth src/hooks/truncator.ts # read key file (smart)
|
|
95
|
+
3. tilth src/index.ts --section "tool.execute.after" # targeted section
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Example 2: tilth unavailable
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
1. tilth --version # fails: not found
|
|
102
|
+
2. glob pattern="src/**/*.ts" # discover paths
|
|
103
|
+
3. read src/hooks/truncator.ts # full content
|
|
104
|
+
4. grep pattern="shouldTruncate" include="*.ts" # pattern search
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Example 3: Large file, want section only
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
1. tilth src/index.ts --section "## Phase 3" # tilth sections it
|
|
111
|
+
(if unavailable)
|
|
112
|
+
2. read src/index.ts offset=820 limit=60 # manual offset fallback
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Combining with Other Skills
|
|
118
|
+
|
|
119
|
+
| If also using | Note |
|
|
120
|
+
|---------------|------|
|
|
121
|
+
| `deep-research` | Use tilth-reading for local navigation; deep-research for external docs |
|
|
122
|
+
| `source-code-research` | tilth-reading replaces raw `read` calls in that skill when tilth is available |
|
|
123
|
+
| `systematic-debugging` | Use tilth --section to isolate the failing function before adding diagnostics |
|
|
@@ -1,53 +1,55 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: using-git-worktrees
|
|
3
|
-
description:
|
|
3
|
+
description: Legacy compatibility skill. Despite the name, the current workflow uses one shared checkout on the repo default branch and does not create git worktrees.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Shared Workspace Development
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
> Legacy skill name: `using-git-worktrees`
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
git rev-parse --is-inside-work-tree # must be inside a repo
|
|
12
|
-
git status --porcelain # must be clean — no uncommitted changes
|
|
13
|
-
```
|
|
10
|
+
This repository no longer uses git worktrees for routine agent execution.
|
|
14
11
|
|
|
15
|
-
##
|
|
12
|
+
## Policy
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
- Work directly in the shared repository checkout
|
|
15
|
+
- Stay on the repo default branch unless the user explicitly approves another branch
|
|
16
|
+
- Do **not** create git worktrees
|
|
17
|
+
- Do **not** create per-task branches to hide conflicts
|
|
18
|
+
- Use Beads reservations to coordinate overlapping edits
|
|
19
|
+
- Pull/rebase frequently so conflicts surface immediately
|
|
20
|
+
|
|
21
|
+
## Start-of-task checks
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
git
|
|
23
|
+
```bash
|
|
24
|
+
git rev-parse --is-inside-work-tree # must be inside a repo
|
|
25
|
+
git branch --show-current # expect: repo default branch (main/master/etc.)
|
|
26
|
+
git status --short --branch # inspect local state before editing
|
|
23
27
|
```
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
If overlapping local changes already touch your files, stop and coordinate — do not isolate the work in another workspace.
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
feature/<id>-<desc> fix/<id>-<desc> hotfix/<id>-<desc>
|
|
29
|
-
refactor/<id>-<desc> experiment/<id>-<desc>
|
|
30
|
-
```
|
|
31
|
+
## During execution
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
- Reserve files with `beads-village_reserve` before editing
|
|
34
|
+
- Keep changes packet-sized and scoped to reserved files
|
|
35
|
+
- Re-run `git status --short --branch` before commit/push to catch unexpected drift
|
|
36
|
+
- If the tree is clean and you need the latest remote updates, sync with:
|
|
33
37
|
|
|
34
38
|
```bash
|
|
35
|
-
|
|
36
|
-
npm install # install deps
|
|
37
|
-
npm test # run baseline — must pass before any changes
|
|
39
|
+
git pull --rebase
|
|
38
40
|
```
|
|
39
41
|
|
|
40
|
-
##
|
|
42
|
+
## End-of-task sync
|
|
41
43
|
|
|
42
44
|
```bash
|
|
43
|
-
|
|
44
|
-
git
|
|
45
|
-
git
|
|
45
|
+
git status --short --branch
|
|
46
|
+
git pull --rebase # when safe and needed
|
|
47
|
+
git push # publish landed changes after verification and sync
|
|
46
48
|
```
|
|
47
49
|
|
|
48
50
|
## Red Flags
|
|
49
51
|
|
|
50
|
-
- Creating worktree
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
52
|
+
- Creating a git worktree or per-task branch for routine work
|
|
53
|
+
- Editing reserved files without coordination
|
|
54
|
+
- Letting local drift accumulate in the shared checkout
|
|
55
|
+
- Using isolation to avoid dealing with real conflicts
|
package/src/agents/AGENTS.md
CHANGED
|
@@ -26,6 +26,20 @@ The three read-only specialists have distinct scopes — choose the right one:
|
|
|
26
26
|
|
|
27
27
|
**Never call `@oracle` for something `@explore` or `@research` can answer.**
|
|
28
28
|
|
|
29
|
+
## File Reading Strategy
|
|
30
|
+
|
|
31
|
+
All agents that read files must follow the **tilth-first chain** (see `skill/tilth-reading/SKILL.md`):
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
1. tilth <path> — smart read (full or outline based on size)
|
|
35
|
+
2. read <path> — fallback: raw full file content
|
|
36
|
+
3. glob <pattern> — fallback: file discovery
|
|
37
|
+
4. grep <pattern> — fallback: content pattern search
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
> The runtime hook (`tilth_reading`) automatically enhances `read` tool output via tilth.
|
|
41
|
+
> Agents should call `tilth` directly for large files to get smart outlines before reading in full.
|
|
42
|
+
|
|
29
43
|
## Active Roles in Compressed Workflow
|
|
30
44
|
|
|
31
45
|
Default active roles:
|