claude-dev-env 1.46.0 → 1.47.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/CLAUDE.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Claude Development Assistant
2
2
 
3
+ The user is short on time and tokens. When you reply, always assume they'll only read your first few sentences and final sentences. Anything else is skimmed at best. Frame your replies accordingly.
4
+
5
+ The user is short on tokens; whenever a task can be achieved cleanly and effectively, optimize to save the user $$ and token usage.
6
+
3
7
  The user delegates execution to you and expects zero manual steps unless strictly necessary. Execute every command you can directly. Only instruct the user to do something manually when you are technically unable to do it yourself. When a task involves credentials or other sensitive input, display a minimal secure UI (e.g., a password dialog) to collect it rather than asking the user to paste it into chat or run the command themselves. When direction is ambiguous, use AskUserQuestion to clarify before acting.
4
8
 
5
9
  ## Code Rules
@@ -18,7 +22,10 @@ Full banned-pattern set + enforcement: `~/.claude/rules/no-historical-clutter.md
18
22
 
19
23
  ## GOTCHAS
20
24
  When making code changes, make sure you are working in the proper worktree path for the task at hand.
21
- When writing to an existing file, you must either EDIT the file, or remove it and THEN re-write it if it's truly a full re-write.
25
+
26
+ ## Choosing Edit vs Write
27
+
28
+ `Edit` changes existing files; `Write` creates new ones. Default to `Edit` — reach for `Write` only for a genuinely new path. For a true full rewrite, delete the file first, then `Write`.
22
29
 
23
30
  ## File-Global Constants
24
31
 
@@ -32,6 +32,14 @@ def get_zoekt_redirect_guidance() -> str:
32
32
  "positively, e.g. mcp__zoekt__search(query=\"your pattern file:"
33
33
  + worktree_filter_fragment
34
34
  + "<branch>/\").\n\n"
35
+ "INDEX FRESHNESS: the index trails just-written code — recent or unpushed commits sync and reindex "
36
+ "on a short delay, so a symbol you just added can be missing from Zoekt for a few minutes even though "
37
+ "it is on disk. Worktrees are fully indexed and retrievable with the positive 'file:"
38
+ + worktree_filter_fragment
39
+ + "<branch>/' filter above, but that same lag applies to anything freshly edited. When a Zoekt search "
40
+ "returns nothing for code you know exists on disk, do not treat it as absent: Grep a specific file "
41
+ "(a path ending in a file extension is exempt from this redirect) or read the file directly to confirm "
42
+ "current contents.\n\n"
35
43
  "INDEX ROOTS (when Grep/Search in a tree is redirected): set ZOEKT_REDIRECT_INDEXED_ROOTS to a JSON array "
36
44
  "of absolute paths, or ~/.claude/zoekt-indexed-roots.json as {\"roots\": [\"/abs/path/to/repo/\", ...]}. "
37
45
  "Optional ZOEKT_REDIRECT_INDEXED_ROOTS_FILE points to a different JSON file. "
@@ -81,6 +81,12 @@ class RedirectGuidanceWorktreeTests(unittest.TestCase):
81
81
  def test_worktree_display_fragment_is_the_unescaped_path(self) -> None:
82
82
  self.assertEqual(worktree_path_display_fragment(), ".claude/worktrees/")
83
83
 
84
+ def test_guidance_documents_index_freshness_escape_hatch(self) -> None:
85
+ guidance = get_zoekt_redirect_guidance()
86
+ self.assertIn("INDEX FRESHNESS:", guidance)
87
+ self.assertIn("exempt from this redirect", guidance)
88
+ self.assertIn("read the file directly", guidance)
89
+
84
90
 
85
91
  if __name__ == "__main__":
86
92
  unittest.main()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-dev-env",
3
- "version": "1.46.0",
3
+ "version": "1.47.0",
4
4
  "description": "Claude Code development standards — rules, hooks, agents, commands, and skills",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,8 +5,10 @@ description: >-
5
5
  `/compact <directive>` string to the operator's clipboard so the next prompt
6
6
  is a single paste. The directive pins the session's load-bearing identifiers
7
7
  (branch, PR, HEAD, worktree, in-flight work, decisions, blockers, files in
8
- play, follow-ups) and lists the redundant tool outputs the summarizer should
9
- drop. Use when the user says `/pre-compact`, asks to prep for compaction, or
8
+ play, follow-ups) the next steps depend on, so the summarizer keeps them with
9
+ high fidelity. It confirms the operator's intent for the next chat through a
10
+ structured question first, then validates each identifier against its live
11
+ source before stating it. Use when the user says `/pre-compact`, asks to prep for compaction, or
10
12
  asks to compose a focus directive for `/compact`.
11
13
  disable-model-invocation: true
12
14
  ---
@@ -20,16 +22,35 @@ string to the operator's clipboard.
20
22
 
21
23
  **Announce at start:** "I'm composing your compact focus directive."
22
24
 
23
- ## Step 1 — Read the live session
24
-
25
- Pull the load-bearing identifiers from the current conversation. Run
26
- `git status`, `git rev-parse --short HEAD`, or `gh pr view` when values are
27
- not already in context.
25
+ ## Step 1 — Confirm the next-session intent
26
+
27
+ Before composing anything, ask the operator what they intend to work on in
28
+ the next chat. Do not infer it silently from the conversation, and do not
29
+ ask it raw — use `AskUserQuestion` with two to four options drawn from the
30
+ session context (the threads left open, the obvious next actions, the task
31
+ the operator last steered toward); the tool's free-text fallback covers
32
+ anything unlisted. The selected intent is the directive's forward task:
33
+ Step 2 scopes every field to what that intent needs, and the rendered
34
+ `In-flight` line states it.
35
+
36
+ ## Step 2 — Read and validate the live session
37
+
38
+ Validate every identifier directly before stating it. Conversation context
39
+ goes stale within a session — a PR merges, HEAD advances, a worktree
40
+ advances to a newer commit — so confirm each value against its live source
41
+ at compose time rather than carrying it from memory. Run the command in
42
+ each field's Source column; for a PR, capture its merge state
43
+ (`gh pr view --json state,mergedAt`) and state `merged` or `open` from that
44
+ result, never from recollection. A value that cannot be confirmed against a
45
+ live source is not dropped silently — surface it to the operator via
46
+ `AskUserQuestion` to clarify (offer the candidate values found plus the
47
+ free-text fallback) and use the answer. Omit it only when the operator
48
+ chooses to skip it.
28
49
 
29
50
  | Field | What to capture | Source |
30
51
  |---|---|---|
31
52
  | `branch` | Active branch name | `git branch --show-current` |
32
- | `pr` | Active PR number, when one exists | `gh pr view --json number` |
53
+ | `pr` | Active PR number and its merge state (open / merged), when one exists | `gh pr view --json number,state,mergedAt` |
33
54
  | `head` | Short HEAD SHA (whatever `git rev-parse --short` outputs) | `git rev-parse --short HEAD` |
34
55
  | `worktree` | Absolute path to the working directory | `pwd` |
35
56
  | `in_flight` | One sentence describing what is being worked on right now | conversation |
@@ -41,7 +62,15 @@ not already in context.
41
62
  A field whose value cannot be stated as a concrete identifier is omitted
42
63
  from the directive.
43
64
 
44
- ## Step 2 Render the directive
65
+ Scope every field to what the Step 1 intent needs next. Compaction carries
66
+ forward the slice of session history the remaining work needs: capture a
67
+ `decision`, `blocker`, or `in_flight` detail when a next step relies on
68
+ it, and leave a detail the next steps do not touch (a settled question, a
69
+ resolved blocker, a path not taken) out by simply not listing it. When a
70
+ settled decision still constrains the next step, list its outcome as one
71
+ line, not the deliberation behind it.
72
+
73
+ ## Step 3 — Render the directive
45
74
 
46
75
  Render this exact shape, populating only the fields with concrete values:
47
76
 
@@ -56,25 +85,21 @@ Preserve:
56
85
  - Blockers: <bullet per blocker>
57
86
  - Files: <path>, <path>, <path>
58
87
  - Follow-ups: <bullet per follow-up>
59
-
60
- Drop:
61
- - Tool outputs already applied to files
62
- - Per-tick progress narration
63
- - Resolved findings and superseded SHAs
64
- - Listing/grep output whose conclusion appears above
65
88
  ```
66
89
 
67
- The `Preserve:` block leads so the summarizer maximizes recall first. The
68
- `Drop:` block lists the lightest-touch removals raw tool outputs are the
69
- safest content to drop because the work they produced lives in the files
70
- and commits.
90
+ The directive lists only what the next steps consume, so the summarizer
91
+ preserves that with high fidelity and compresses the rest of the trace on
92
+ its own naming what to keep is a clearer instruction than enumerating
93
+ what to cut. Keep the list tight: a `Preserve:` block padded with finished
94
+ or out-of-scope context dilutes the summarizer's focus on what happens
95
+ next.
71
96
 
72
97
  Source: [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents)
73
98
  — "start by maximizing recall to ensure your compaction prompt captures
74
99
  every relevant piece of information from the trace, then iterate to improve
75
100
  precision by eliminating superfluous content."
76
101
 
77
- ## Step 3 — Copy `/compact <directive>` to the clipboard
102
+ ## Step 4 — Copy `/compact <directive>` to the clipboard
78
103
 
79
104
  Write the full `/compact <directive>` string to a temporary file via the
80
105
  Write tool, then copy the file contents to the clipboard with PowerShell:
@@ -91,7 +116,7 @@ unmodified regardless of which characters it contains.
91
116
  A reasonable temp path under `$env:TEMP` (Windows) or `$TMPDIR` (POSIX)
92
117
  works; clean it up after the `Set-Clipboard` call returns.
93
118
 
94
- ## Step 4 — Hand off
119
+ ## Step 5 — Hand off
95
120
 
96
121
  Print this confirmation line to the operator:
97
122
 
@@ -99,8 +124,8 @@ Print this confirmation line to the operator:
99
124
  > compact this conversation with focus.
100
125
 
101
126
  Then list up to the first three `Preserve:` bullets (or fewer when the
102
- directive omits fields) and the first `Drop:` bullet inline so the
103
- operator can spot-check before pasting.
127
+ directive omits fields) inline so the operator can spot-check before
128
+ pasting.
104
129
 
105
130
  ---
106
131