azclaude-copilot 0.5.3 → 0.5.5

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/README.md CHANGED
@@ -758,11 +758,11 @@ An agent is a sub-process. Use one when work must happen **in parallel** or **in
758
758
 
759
759
  ## Verified
760
760
 
761
- 1767 tests. Every template, command, capability, agent, hook, and CLI feature verified.
761
+ 1788 tests. Every template, command, capability, agent, hook, and CLI feature verified.
762
762
 
763
763
  ```bash
764
764
  bash tests/test-features.sh
765
- # Results: 1767 passed, 0 failed, 1767 total
765
+ # Results: 1788 passed, 0 failed, 1788 total
766
766
  ```
767
767
 
768
768
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "azclaude-copilot",
3
- "version": "0.5.3",
3
+ "version": "0.5.5",
4
4
  "description": "AI coding environment — 39 commands, 10 skills, 15 agents, memory, reflexes, evolution. Install: npx azclaude-copilot@latest, then open Claude Code.",
5
5
  "bin": {
6
6
  "azclaude": "bin/cli.js",
@@ -28,6 +28,7 @@ Load only the files that match the current task. Never load the full list.
28
28
  | shared/intelligent-dispatch.md | About to build, fix, refactor, audit, or ship — non-trivial scope (3+ files or structural) — pre-flight analysis via problem-architect | ~300 |
29
29
  | shared/context-inoculation.md | /copilot dispatch, milestone-builder spawn, autonomous agent context — inject anti-reward-hack boundaries (75-90% reduction) | ~120 |
30
30
  | shared/reward-hack-detection.md | /audit, /ship, post-milestone review — detect reward hacking patterns in test modifications | ~150 |
31
+ | shared/ultrathink.md | $ARGUMENTS contains --deep, or command needs extended thinking for complex analysis | ~80 |
31
32
 
32
33
  ## Level Builders — load ONE at a time
33
34
  | File | When to load | Tokens |
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: ultrathink
3
+ description: >
4
+ Load when $ARGUMENTS contains --deep, or when a command needs extended thinking
5
+ for complex analysis. Activates deep reasoning mode — coupling analysis, root-cause
6
+ hypotheses, architectural trade-offs, and multi-constraint planning all benefit.
7
+ tokens: ~80
8
+ ---
9
+
10
+ ## Deep Reasoning Mode — ultrathink
11
+
12
+ Extended thinking is now active. Use it for the current task.
13
+
14
+ ### When Deep Reasoning Helps
15
+
16
+ - **Coupling analysis** — trace dependencies across 5+ files before committing to a plan
17
+ - **Root-cause hypotheses** — consider 3+ competing explanations before picking one
18
+ - **Architectural trade-offs** — weigh multiple criteria (performance, maintainability, cost) simultaneously
19
+ - **Wave planning** — optimize parallel dispatch across milestones with shared resources
20
+ - **Adversarial analysis** — steelman both sides of a debate before declaring a winner
21
+
22
+ ### How to Apply
23
+
24
+ 1. **Think before acting** — spend more reasoning on analysis steps, not on boilerplate
25
+ 2. **Consider alternatives** — explicitly enumerate 2-3 approaches before choosing
26
+ 3. **Trace consequences** — for each change, trace downstream effects before writing
27
+ 4. **Challenge assumptions** — question whether the obvious approach is actually correct
28
+ 5. **Deeper search** — read more files, grep more broadly, check edge cases others skip
29
+
30
+ ### What NOT to Do
31
+
32
+ - Do not add verbosity to output — deep thinking is internal, output stays concise
33
+ - Do not slow down mechanical steps (file writes, test runs) — only deepen analysis
34
+ - Do not second-guess decisions already made — apply deep thinking forward, not backward
@@ -18,6 +18,17 @@ Load: shared/tdd.md + shared/completion-rule.md
18
18
 
19
19
  ---
20
20
 
21
+ ## Deep Mode Detection
22
+
23
+ If `$ARGUMENTS` contains `--deep`:
24
+ 1. Strip `--deep` from arguments before processing
25
+ 2. Load `shared/ultrathink.md` — enables extended thinking for complex features
26
+ 3. At the Complexity Gate: analyze 2-3 implementation approaches with trade-offs before choosing
27
+ 4. Trace downstream effects — what tests, configs, and consumers will this change affect?
28
+ 5. Consider edge cases that quick implementation would miss
29
+
30
+ ---
31
+
21
32
  ## Pre-Flight: Constitution + Code Rules + Spec Check
22
33
 
23
34
  ```bash
@@ -17,6 +17,17 @@ allowed-tools: Read, Grep, Glob, Bash
17
17
 
18
18
  $ARGUMENTS
19
19
 
20
+ ## Deep Mode Detection
21
+
22
+ If `$ARGUMENTS` contains `--deep`:
23
+ 1. Strip `--deep` from arguments before processing
24
+ 2. Load `shared/ultrathink.md` — enables extended thinking for coupling analysis, wave planning, and risk assessment
25
+ 3. In Step 2 (Map the Impact): read MORE files, trace dependencies deeper, check 2nd-order effects
26
+ 4. In Step 3 (Write the Plan): consider 2-3 alternative approaches before choosing the plan structure
27
+ 5. In Parallel Planning: spend more reasoning on coupling analysis — catch subtle shared-resource conflicts
28
+
29
+ ---
30
+
20
31
  **Use /add for straightforward features. Use /blueprint when:**
21
32
  - The change touches 4+ files
22
33
  - It involves a schema, API contract, or interface change
@@ -11,6 +11,15 @@ $ARGUMENTS
11
11
 
12
12
  ---
13
13
 
14
+ ## Deep Mode Detection
15
+
16
+ If `$ARGUMENTS` contains `--deep`:
17
+ 1. Strip `--deep` from arguments before processing
18
+ 2. Load `shared/ultrathink.md` — enables extended thinking for adversarial analysis
19
+ 3. Steelman each position harder — find the strongest version of every argument before comparing
20
+ 4. Consider 2nd-order consequences: "if we pick A, what breaks in 6 months?"
21
+ 5. Search for hidden third options that neither side proposed
22
+
14
23
  ---
15
24
 
16
25
  ## When to Use This
@@ -13,6 +13,17 @@ $ARGUMENTS
13
13
 
14
14
  ---
15
15
 
16
+ ## Deep Mode Detection
17
+
18
+ If `$ARGUMENTS` contains `--deep`:
19
+ 1. Strip `--deep` from arguments before processing
20
+ 2. Load `shared/ultrathink.md` — enables extended thinking for vision exploration
21
+ 3. Explore 3+ architectural approaches before choosing the stack
22
+ 4. Consider scaling implications, deployment complexity, and team skill requirements
23
+ 5. Research deeper — use WebSearch for current best practices before committing to a direction
24
+
25
+ ---
26
+
16
27
  ## Copilot Mode Detection
17
28
 
18
29
  ```bash
@@ -14,6 +14,17 @@ Load: shared/tdd.md + shared/completion-rule.md before starting.
14
14
 
15
15
  ---
16
16
 
17
+ ## Deep Mode Detection
18
+
19
+ If `$ARGUMENTS` contains `--deep`:
20
+ 1. Strip `--deep` from arguments before processing
21
+ 2. Load `shared/ultrathink.md` — enables extended thinking for root-cause analysis
22
+ 3. In Phase 3 (Hypothesize): generate 3+ competing hypotheses before committing to one
23
+ 4. Trace each hypothesis through the full call chain — don't stop at the first plausible explanation
24
+ 5. Check for systemic causes: is this a symptom of a deeper architectural issue?
25
+
26
+ ---
27
+
17
28
  ## Pre-Flight: Constitution + Code Rules Check
18
29
 
19
30
  ```bash
@@ -195,6 +195,48 @@ try {
195
195
  }
196
196
  } catch (_) {}
197
197
 
198
+ // ── Compaction Guard — auto-snapshot before context is lost ─────────────────
199
+ // Reads context % signal from statusline (written to temp file after each turn).
200
+ // At >= 70%: warns Claude to save state. At >= 85%: auto-saves checkpoint.
201
+ try {
202
+ const ctxSignalPath = path.join(os.tmpdir(), `.azclaude-ctx-${process.ppid || process.pid}`);
203
+ if (fs.existsSync(ctxSignalPath)) {
204
+ const ctxSignal = JSON.parse(fs.readFileSync(ctxSignalPath, 'utf8'));
205
+ const pct = ctxSignal.ctxPct || 0;
206
+
207
+ if (pct >= 85) {
208
+ // AUTO-SAVE: context is critically high — save checkpoint before compaction wipes it
209
+ const checkpointDir = path.join(cfg, 'memory', 'checkpoints');
210
+ try { fs.mkdirSync(checkpointDir, { recursive: true }); } catch (_) {}
211
+ const ts = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 16);
212
+ const cpPath = path.join(checkpointDir, `${ts}-auto-compaction.md`);
213
+
214
+ // Only auto-save once per threshold crossing (check if already saved)
215
+ const autoSaveMarker = path.join(os.tmpdir(), `.azclaude-autosave-${process.ppid || process.pid}`);
216
+ if (!fs.existsSync(autoSaveMarker)) {
217
+ // Copy goals.md as checkpoint
218
+ if (fs.existsSync(goalsPath)) {
219
+ const goalsContent = fs.readFileSync(goalsPath, 'utf8');
220
+ const header = `---\ndate: ${new Date().toISOString()}\nlabel: auto-compaction-guard-${pct}pct\nfiles_in_progress: []\n---\n\n`;
221
+ fs.writeFileSync(cpPath, header + '## Auto-saved before compaction\n\n' + goalsContent);
222
+ fs.writeFileSync(autoSaveMarker, '');
223
+ }
224
+
225
+ console.log('');
226
+ console.log(`--- COMPACTION GUARD (${pct}%) ---`);
227
+ console.log(`Context at ${pct}% — AUTO-SAVED checkpoint to ${path.basename(cpPath)}`);
228
+ console.log('Run /snapshot NOW to save your reasoning and decisions (goals.md alone is not enough).');
229
+ console.log('--- END GUARD ---');
230
+ }
231
+ } else if (pct >= 70) {
232
+ console.log('');
233
+ console.log(`--- COMPACTION WARNING (${pct}%) ---`);
234
+ console.log(`Context at ${pct}% — compaction approaching. Run /snapshot to save session state.`);
235
+ console.log('--- END WARNING ---');
236
+ }
237
+ }
238
+ } catch (_) {}
239
+
198
240
  // ── First message only — inject full context ────────────────────────────────
199
241
  if (!isFirstMessage) process.exit(0);
200
242
 
@@ -117,6 +117,13 @@ process.stdin.on('end', () => {
117
117
  const empty = 10 - filled;
118
118
  const bar = '\u2593'.repeat(filled) + '\u2591'.repeat(empty);
119
119
 
120
+ // ── Compaction signal — write context % to temp file for hook to read ──
121
+ // This enables the UserPromptSubmit hook to auto-snapshot before compaction.
122
+ try {
123
+ const signalPath = path.join(require('os').tmpdir(), `.azclaude-ctx-${process.ppid || process.pid}`);
124
+ fs.writeFileSync(signalPath, JSON.stringify({ ctxPct, turnsLeft: compactHint ? parseInt(compactHint.replace(/[^0-9]/g,'')) : 999 }));
125
+ } catch (_) {}
126
+
120
127
  // ── Color thresholds ──
121
128
  let ctxColor, ctxWarn = '';
122
129
  if (ctxPct >= 80) { ctxColor = RED; ctxWarn = ' COMPACT SOON'; }