chief-clancy 0.8.22 → 0.9.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.
Files changed (94) hide show
  1. package/bin/clancy.js +153 -0
  2. package/package.json +8 -88
  3. package/README.md +0 -292
  4. package/dist/bundle/clancy-afk.js +0 -6
  5. package/dist/bundle/clancy-once.js +0 -239
  6. package/dist/installer/file-ops/file-ops.d.ts +0 -32
  7. package/dist/installer/file-ops/file-ops.d.ts.map +0 -1
  8. package/dist/installer/file-ops/file-ops.js +0 -58
  9. package/dist/installer/file-ops/file-ops.js.map +0 -1
  10. package/dist/installer/hook-installer/hook-installer.d.ts +0 -31
  11. package/dist/installer/hook-installer/hook-installer.d.ts.map +0 -1
  12. package/dist/installer/hook-installer/hook-installer.js +0 -137
  13. package/dist/installer/hook-installer/hook-installer.js.map +0 -1
  14. package/dist/installer/install.d.ts +0 -3
  15. package/dist/installer/install.d.ts.map +0 -1
  16. package/dist/installer/install.js +0 -270
  17. package/dist/installer/install.js.map +0 -1
  18. package/dist/installer/manifest/manifest.d.ts +0 -41
  19. package/dist/installer/manifest/manifest.d.ts.map +0 -1
  20. package/dist/installer/manifest/manifest.js +0 -97
  21. package/dist/installer/manifest/manifest.js.map +0 -1
  22. package/dist/installer/prompts/prompts.d.ts +0 -33
  23. package/dist/installer/prompts/prompts.d.ts.map +0 -1
  24. package/dist/installer/prompts/prompts.js +0 -55
  25. package/dist/installer/prompts/prompts.js.map +0 -1
  26. package/dist/installer/role-filter/role-filter.d.ts +0 -15
  27. package/dist/installer/role-filter/role-filter.d.ts.map +0 -1
  28. package/dist/installer/role-filter/role-filter.js +0 -48
  29. package/dist/installer/role-filter/role-filter.js.map +0 -1
  30. package/dist/installer/ui/ui.d.ts +0 -9
  31. package/dist/installer/ui/ui.d.ts.map +0 -1
  32. package/dist/installer/ui/ui.js +0 -94
  33. package/dist/installer/ui/ui.js.map +0 -1
  34. package/dist/scripts/shared/env-parser/env-parser.d.ts +0 -30
  35. package/dist/scripts/shared/env-parser/env-parser.d.ts.map +0 -1
  36. package/dist/scripts/shared/env-parser/env-parser.js +0 -64
  37. package/dist/scripts/shared/env-parser/env-parser.js.map +0 -1
  38. package/dist/utils/ansi/ansi.d.ts +0 -55
  39. package/dist/utils/ansi/ansi.d.ts.map +0 -1
  40. package/dist/utils/ansi/ansi.js +0 -55
  41. package/dist/utils/ansi/ansi.js.map +0 -1
  42. package/hooks/clancy-branch-guard.js +0 -128
  43. package/hooks/clancy-check-update.js +0 -114
  44. package/hooks/clancy-context-monitor.js +0 -189
  45. package/hooks/clancy-credential-guard.js +0 -120
  46. package/hooks/clancy-drift-detector.js +0 -96
  47. package/hooks/clancy-notification.js +0 -105
  48. package/hooks/clancy-post-compact.js +0 -53
  49. package/hooks/clancy-statusline.js +0 -82
  50. package/hooks/package.json +0 -3
  51. package/registry/boards.json +0 -44
  52. package/src/agents/arch-agent.md +0 -72
  53. package/src/agents/concerns-agent.md +0 -89
  54. package/src/agents/design-agent.md +0 -130
  55. package/src/agents/devils-advocate.md +0 -53
  56. package/src/agents/quality-agent.md +0 -161
  57. package/src/agents/tech-agent.md +0 -92
  58. package/src/agents/verification-gate.md +0 -128
  59. package/src/roles/implementer/commands/dry-run.md +0 -14
  60. package/src/roles/implementer/commands/once.md +0 -17
  61. package/src/roles/implementer/commands/run.md +0 -11
  62. package/src/roles/implementer/workflows/once.md +0 -146
  63. package/src/roles/implementer/workflows/run.md +0 -127
  64. package/src/roles/planner/commands/approve-plan.md +0 -10
  65. package/src/roles/planner/commands/plan.md +0 -20
  66. package/src/roles/planner/workflows/approve-plan.md +0 -535
  67. package/src/roles/planner/workflows/plan.md +0 -536
  68. package/src/roles/reviewer/commands/logs.md +0 -7
  69. package/src/roles/reviewer/commands/review.md +0 -9
  70. package/src/roles/reviewer/commands/status.md +0 -9
  71. package/src/roles/reviewer/workflows/logs.md +0 -104
  72. package/src/roles/reviewer/workflows/review.md +0 -186
  73. package/src/roles/reviewer/workflows/status.md +0 -134
  74. package/src/roles/setup/commands/doctor.md +0 -7
  75. package/src/roles/setup/commands/help.md +0 -80
  76. package/src/roles/setup/commands/init.md +0 -7
  77. package/src/roles/setup/commands/map-codebase.md +0 -16
  78. package/src/roles/setup/commands/settings.md +0 -7
  79. package/src/roles/setup/commands/uninstall.md +0 -5
  80. package/src/roles/setup/commands/update-docs.md +0 -9
  81. package/src/roles/setup/commands/update.md +0 -12
  82. package/src/roles/setup/workflows/doctor.md +0 -124
  83. package/src/roles/setup/workflows/init.md +0 -1073
  84. package/src/roles/setup/workflows/map-codebase.md +0 -125
  85. package/src/roles/setup/workflows/scaffold.md +0 -845
  86. package/src/roles/setup/workflows/settings.md +0 -944
  87. package/src/roles/setup/workflows/uninstall.md +0 -161
  88. package/src/roles/setup/workflows/update-docs.md +0 -92
  89. package/src/roles/setup/workflows/update.md +0 -277
  90. package/src/roles/strategist/commands/approve-brief.md +0 -21
  91. package/src/roles/strategist/commands/brief.md +0 -27
  92. package/src/roles/strategist/workflows/approve-brief.md +0 -834
  93. package/src/roles/strategist/workflows/brief.md +0 -890
  94. package/src/templates/CLAUDE.md +0 -87
@@ -1,105 +0,0 @@
1
- #!/usr/bin/env node
2
- // Clancy Desktop Notification — Notification hook.
3
- // Sends native OS desktop notifications when Claude fires a Notification event.
4
- // Best-effort — never crashes, exit 0 on any error.
5
- //
6
- // Controllable via CLANCY_DESKTOP_NOTIFY=false to suppress.
7
- //
8
- // Platform detection:
9
- // macOS: osascript -e 'display notification "msg" with title "Clancy"'
10
- // Linux: notify-send "Clancy" "msg"
11
- // Windows: PowerShell [System.Windows.Forms.MessageBox]::Show("msg", "Clancy")
12
-
13
- 'use strict';
14
-
15
- const { execFileSync } = require('child_process');
16
- const os = require('os');
17
-
18
- /**
19
- * Detect the platform and return a function that sends a notification.
20
- * Returns null if the platform is unsupported.
21
- */
22
- function getNotifier() {
23
- const platform = os.platform();
24
-
25
- if (platform === 'darwin') {
26
- return function notifyMac(message) {
27
- const escaped = message.replace(/"/g, '\\"');
28
- execFileSync('osascript', [
29
- '-e',
30
- `display notification "${escaped}" with title "Clancy"`,
31
- ], { timeout: 5000, windowsHide: true });
32
- };
33
- }
34
-
35
- if (platform === 'linux') {
36
- return function notifyLinux(message) {
37
- execFileSync('notify-send', ['Clancy', message], {
38
- timeout: 5000,
39
- windowsHide: true,
40
- });
41
- };
42
- }
43
-
44
- if (platform === 'win32') {
45
- return function notifyWindows(message) {
46
- const escaped = message.replace(/[`$"]/g, '`$&');
47
- execFileSync('powershell', [
48
- '-NoProfile',
49
- '-Command',
50
- `Add-Type -AssemblyName System.Windows.Forms; [System.Windows.Forms.MessageBox]::Show("${escaped}", "Clancy")`,
51
- ], { timeout: 5000, windowsHide: true });
52
- };
53
- }
54
-
55
- return null;
56
- }
57
-
58
- /**
59
- * Extract a message string from the hook event payload.
60
- */
61
- function extractMessage(data) {
62
- // Notification events may carry a message in various shapes
63
- if (data.message && typeof data.message === 'string') return data.message;
64
- if (data.notification && typeof data.notification === 'string') return data.notification;
65
- if (data.text && typeof data.text === 'string') return data.text;
66
- if (data.hookSpecificOutput && data.hookSpecificOutput.message) return data.hookSpecificOutput.message;
67
- return 'Clancy notification';
68
- }
69
-
70
- let input = '';
71
- const stdinTimeout = setTimeout(() => process.exit(0), 3000);
72
- process.stdin.setEncoding('utf8');
73
- process.stdin.on('data', chunk => { input += chunk; });
74
- process.stdin.on('end', () => {
75
- clearTimeout(stdinTimeout);
76
- try {
77
- // Check if notifications are disabled
78
- if (process.env.CLANCY_DESKTOP_NOTIFY === 'false') {
79
- process.exit(0);
80
- }
81
-
82
- const data = JSON.parse(input);
83
- const message = extractMessage(data);
84
-
85
- const notifier = getNotifier();
86
- if (notifier) {
87
- try {
88
- notifier(message);
89
- } catch {
90
- // OS command failed — fall back to console.log
91
- console.log(`[Clancy] ${message}`);
92
- }
93
- } else {
94
- // Unsupported platform — fall back to console.log
95
- console.log(`[Clancy] ${message}`);
96
- }
97
- } catch {
98
- process.exit(0);
99
- }
100
- });
101
-
102
- // Export for testing
103
- if (typeof module !== 'undefined') {
104
- module.exports = { getNotifier, extractMessage };
105
- }
@@ -1,53 +0,0 @@
1
- #!/usr/bin/env node
2
- // Clancy PostCompact Hook — re-injects ticket context after context compaction.
3
- // Reads .clancy/lock.json for current ticket info. If no lock file exists
4
- // (not in a Clancy run), exits silently.
5
- //
6
- // PostCompact is a non-blocking event — this hook injects additionalContext
7
- // but cannot prevent compaction.
8
-
9
- 'use strict';
10
-
11
- const fs = require('fs');
12
- const path = require('path');
13
-
14
- let input = '';
15
- const stdinTimeout = setTimeout(() => process.exit(0), 3000);
16
- process.stdin.setEncoding('utf8');
17
- process.stdin.on('data', chunk => { input += chunk; });
18
- process.stdin.on('end', () => {
19
- clearTimeout(stdinTimeout);
20
- try {
21
- const data = JSON.parse(input);
22
- const cwd = data.cwd || process.cwd();
23
-
24
- // Read lock file for ticket context
25
- const lockPath = path.join(cwd, '.clancy', 'lock.json');
26
- if (!fs.existsSync(lockPath)) process.exit(0); // Not in a Clancy run
27
-
28
- const lock = JSON.parse(fs.readFileSync(lockPath, 'utf8'));
29
-
30
- // Validate minimum required fields — skip if lock is malformed
31
- if (!lock.ticketKey || !lock.ticketBranch) process.exit(0);
32
-
33
- // Truncate description to 2000 chars to avoid consuming too much fresh context
34
- const desc = (lock.description || '').slice(0, 2000);
35
-
36
- const context = [
37
- `CONTEXT RESTORED: You are implementing ticket [${lock.ticketKey}] ${lock.ticketTitle || 'Unknown'}.`,
38
- `Branch: ${lock.ticketBranch} targeting ${lock.targetBranch || 'main'}.`,
39
- lock.parentKey && lock.parentKey !== 'none' ? `Parent: ${lock.parentKey}.` : '',
40
- desc ? `Requirements: ${desc}` : '',
41
- 'Continue your implementation. Do not start over.',
42
- ].filter(Boolean).join('\n');
43
-
44
- process.stdout.write(JSON.stringify({
45
- hookSpecificOutput: {
46
- hookEventName: 'PostCompact',
47
- additionalContext: context,
48
- },
49
- }));
50
- } catch {
51
- process.exit(0); // Best-effort — never crash
52
- }
53
- });
@@ -1,82 +0,0 @@
1
- #!/usr/bin/env node
2
- // Clancy Statusline hook — registered as the Claude Code statusline.
3
- // Two jobs:
4
- // 1. Write context metrics to a bridge file so the PostToolUse context
5
- // monitor can read them (the statusline is the only hook that receives
6
- // context_window data directly).
7
- // 2. Output a statusline string showing context usage and update status.
8
-
9
- 'use strict';
10
-
11
- const fs = require('fs');
12
- const path = require('path');
13
- const os = require('os');
14
-
15
- const homeDir = os.homedir();
16
-
17
- let input = '';
18
- const stdinTimeout = setTimeout(() => process.exit(0), 3000);
19
- process.stdin.setEncoding('utf8');
20
- process.stdin.on('data', chunk => { input += chunk; });
21
- process.stdin.on('end', () => {
22
- clearTimeout(stdinTimeout);
23
- try {
24
- const data = JSON.parse(input);
25
- const session = data.session_id || '';
26
- const remaining = data.context_window?.remaining_percentage;
27
-
28
- // Write bridge file for the context monitor PostToolUse hook
29
- if (session && remaining != null) {
30
- try {
31
- const bridgePath = path.join(os.tmpdir(), `clancy-ctx-${session}.json`);
32
- // Claude Code reserves ~16.5% for autocompact buffer.
33
- // Normalise to show 100% at the usable limit (same as GSD).
34
- const AUTO_COMPACT_BUFFER_PCT = 16.5;
35
- const usableRemaining = Math.max(0, ((remaining - AUTO_COMPACT_BUFFER_PCT) / (100 - AUTO_COMPACT_BUFFER_PCT)) * 100);
36
- const used = Math.max(0, Math.min(100, Math.round(100 - usableRemaining)));
37
- fs.writeFileSync(bridgePath, JSON.stringify({
38
- session_id: session,
39
- remaining_percentage: remaining,
40
- used_pct: used,
41
- timestamp: Math.floor(Date.now() / 1000),
42
- }));
43
- } catch { /* bridge is best-effort */ }
44
- }
45
-
46
- // Build statusline output
47
- const parts = [];
48
-
49
- // Update available?
50
- const claudeDir = process.env.CLAUDE_CONFIG_DIR || path.join(homeDir, '.claude');
51
- const cacheFile = path.join(claudeDir, 'cache', 'clancy-update-check.json');
52
- try {
53
- const cache = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
54
- if (cache.update_available) {
55
- parts.push('\x1b[33m⬆ /clancy:update\x1b[0m');
56
- }
57
- } catch { /* cache missing is normal */ }
58
-
59
- // Context bar
60
- if (remaining != null) {
61
- const AUTO_COMPACT_BUFFER_PCT = 16.5;
62
- const usableRemaining = Math.max(0, ((remaining - AUTO_COMPACT_BUFFER_PCT) / (100 - AUTO_COMPACT_BUFFER_PCT)) * 100);
63
- const used = Math.max(0, Math.min(100, Math.round(100 - usableRemaining)));
64
- const filled = Math.floor(used / 10);
65
- const bar = '█'.repeat(filled) + '░'.repeat(10 - filled);
66
-
67
- let coloredBar;
68
- if (used < 50) coloredBar = `\x1b[32m${bar} ${used}%\x1b[0m`;
69
- else if (used < 65) coloredBar = `\x1b[33m${bar} ${used}%\x1b[0m`;
70
- else if (used < 80) coloredBar = `\x1b[38;5;208m${bar} ${used}%\x1b[0m`;
71
- else coloredBar = `\x1b[5;31m💀 ${bar} ${used}%\x1b[0m`;
72
-
73
- parts.push(`\x1b[2mClancy\x1b[0m ${coloredBar}`);
74
- } else {
75
- parts.push('\x1b[2mClancy\x1b[0m');
76
- }
77
-
78
- process.stdout.write(parts.join(' │ '));
79
- } catch {
80
- process.exit(0);
81
- }
82
- });
@@ -1,3 +0,0 @@
1
- {
2
- "type": "commonjs"
3
- }
@@ -1,44 +0,0 @@
1
- {
2
- "boards": [
3
- {
4
- "id": "jira",
5
- "name": "Jira",
6
- "author": "Atlassian",
7
- "url": "https://www.atlassian.com/software/jira",
8
- "env": [
9
- "JIRA_BASE_URL",
10
- "JIRA_USER",
11
- "JIRA_API_TOKEN",
12
- "JIRA_PROJECT_KEY",
13
- "CLANCY_JQL_STATUS",
14
- "CLANCY_JQL_SPRINT",
15
- "CLANCY_LABEL",
16
- "CLANCY_BASE_BRANCH"
17
- ]
18
- },
19
- {
20
- "id": "github",
21
- "name": "GitHub Issues",
22
- "author": "GitHub",
23
- "url": "https://github.com",
24
- "env": [
25
- "GITHUB_TOKEN",
26
- "GITHUB_REPO",
27
- "CLANCY_LABEL",
28
- "CLANCY_BASE_BRANCH"
29
- ]
30
- },
31
- {
32
- "id": "linear",
33
- "name": "Linear",
34
- "author": "Linear",
35
- "url": "https://linear.app",
36
- "env": [
37
- "LINEAR_API_KEY",
38
- "LINEAR_TEAM_ID",
39
- "CLANCY_LABEL",
40
- "CLANCY_BASE_BRANCH"
41
- ]
42
- }
43
- ]
44
- }
@@ -1,72 +0,0 @@
1
- # Architecture Agent
2
-
3
- You are the architecture agent for Clancy's `map-codebase` command. Your job is to write one doc:
4
- - `.clancy/docs/ARCHITECTURE.md`
5
-
6
- ## Instructions
7
-
8
- 1. Use Glob and Grep extensively before writing anything. Understand the actual structure — never guess.
9
- 2. Use real file paths in your output.
10
- 3. Show HOW things are done with real code examples, not just WHAT exists.
11
- 4. Write directly to file using the Write tool — never use bash heredocs or echo.
12
- 5. Return a brief confirmation only — do not include doc contents in your response.
13
- 6. If a section has no applicable content, write: `<!-- Not applicable to this project -->`
14
-
15
- ## What to look for
16
-
17
- Start by exploring the directory structure:
18
- - Top-level directories (src, app, lib, packages, etc.)
19
- - Key subdirectories and what they contain
20
- - Entry points (main.tsx, index.ts, app/layout.tsx, etc.)
21
-
22
- Then dig into:
23
-
24
- **Overview** — One paragraph describing what the system does and how it's structured. Is it a monorepo? SPA? Full-stack app? API-only? Edge functions?
25
-
26
- **Directory Structure** — Annotated directory tree. Use `tree`-style output. Annotate each directory with its purpose:
27
- ```
28
- src/
29
- components/ — shared UI components
30
- pages/ — Next.js pages (file-based routing)
31
- lib/ — utility functions and shared logic
32
- hooks/ — custom React hooks
33
- store/ — Zustand/Redux/Jotai state
34
- types/ — TypeScript type definitions
35
- styles/ — global CSS, theme tokens
36
- ```
37
-
38
- **Key Modules** — For each significant module/service, describe:
39
- - What it does
40
- - Its public interface (exports)
41
- - Key dependencies
42
- - File path
43
-
44
- **Data Flow** — How data moves through the system. Be specific:
45
- - Where does data enter? (API routes, form submissions, websockets)
46
- - How is it fetched? (SWR, React Query, server components, tRPC)
47
- - How is state managed? (local, global store, server state)
48
- - Where does it leave? (rendered to DOM, sent to API, stored in DB)
49
-
50
- Include a real data flow example from the codebase if possible.
51
-
52
- **API Design** — If the project has an API layer:
53
- - Route structure and conventions
54
- - Auth pattern (JWT, session, API key)
55
- - Request/response patterns
56
- - Error handling conventions
57
- - Real example from the codebase
58
-
59
- **State Management** — If applicable:
60
- - Library used (Zustand, Jotai, Redux, Context, etc.)
61
- - Store structure
62
- - Where stores are initialised
63
- - Real example of a store slice/atom
64
-
65
- ---
66
-
67
- ## Output format
68
-
69
- Write the doc, then respond with:
70
- ```
71
- arch agent complete — ARCHITECTURE.md ({N} lines)
72
- ```
@@ -1,89 +0,0 @@
1
- # Concerns Agent
2
-
3
- You are the concerns agent for Clancy's `map-codebase` command. Your job is to write one doc:
4
- - `.clancy/docs/CONCERNS.md`
5
-
6
- This doc warns Clancy about things to avoid — tech debt, security landmines, fragile areas, deprecated patterns. It's the "don't touch this" and "be careful here" guide.
7
-
8
- ## Instructions
9
-
10
- 1. Use Glob and Grep extensively. Look for warning signs, not just clean code.
11
- 2. Use real file paths in your output.
12
- 3. Be direct and specific — "avoid touching src/lib/legacy-auth.ts" not "there are some legacy files"
13
- 4. Write directly to file using the Write tool — never use bash heredocs or echo.
14
- 5. Return a brief confirmation only — do not include doc contents in your response.
15
- 6. If a section has no applicable content, write: `<!-- Not applicable to this project -->`
16
-
17
- ## What to look for
18
-
19
- ### Known Tech Debt
20
-
21
- Scan for:
22
- - `// TODO`, `// FIXME`, `// HACK`, `// XXX` comments
23
- - Files named `legacy`, `old`, `deprecated`, `temp`, `workaround`
24
- - Commented-out code blocks
25
- - `@deprecated` JSDoc tags
26
- - `console.log` left in source (excluding test files)
27
-
28
- For each significant item: file path, line range, what the debt is, and what risks touching it carries.
29
-
30
- ### Security Considerations
31
-
32
- Scan for:
33
- - Hardcoded credentials or API keys (flag but do not expose values)
34
- - `dangerouslySetInnerHTML` usage — where and is it sanitised?
35
- - SQL query construction (injection risk if dynamic)
36
- - File system access without path validation
37
- - `eval()` or `Function()` usage
38
- - Disabled security headers
39
- - CORS wildcard (`Access-Control-Allow-Origin: *`)
40
- - Cookie settings (httpOnly, secure, sameSite)
41
-
42
- Flag: what it is, where it is, what the risk is, whether it's intentional (e.g. test code).
43
-
44
- ### Performance Bottlenecks
45
-
46
- Look for:
47
- - Large bundle imports without tree-shaking
48
- - Missing memoisation on expensive computations (large list renders, heavy calculations)
49
- - Unoptimised images (no `next/image`, no lazy loading)
50
- - N+1 query patterns in data fetching code
51
- - Synchronous operations in render paths
52
- - Large files (> 500 lines) that are imported widely
53
-
54
- ### Areas to Avoid Changing
55
-
56
- Based on what you've found, list files/directories that are:
57
- - Generated code (never edit directly)
58
- - Shared across many features (high blast radius)
59
- - Poorly tested (risky to modify)
60
- - Currently broken/under investigation
61
-
62
- Example format:
63
- ```markdown
64
- ## Areas to Avoid Changing
65
-
66
- - `src/generated/` — auto-generated from OpenAPI spec, run `yarn generate` to update
67
- - `src/lib/payment/stripe.ts` — payment critical path, 0 tests, modify with extreme caution
68
- - `src/components/DataTable/` — complex state machine, many edge cases, avoid refactoring
69
- ```
70
-
71
- ### Deprecated Patterns
72
-
73
- Document patterns that appear in the codebase but should NOT be used in new code:
74
-
75
- - Old API client that was replaced (but old code still uses it)
76
- - Class components vs function components (if mixed)
77
- - Old state management approach being migrated away from
78
- - Deprecated library APIs still in use
79
-
80
- For each: what the old pattern is, what the new pattern is, where the new pattern is used.
81
-
82
- ---
83
-
84
- ## Output format
85
-
86
- Write the doc, then respond with:
87
- ```
88
- concerns agent complete — CONCERNS.md ({N} lines)
89
- ```
@@ -1,130 +0,0 @@
1
- # Design Agent
2
-
3
- You are the design agent for Clancy's `map-codebase` command. Your job is to write two docs:
4
- - `.clancy/docs/DESIGN-SYSTEM.md`
5
- - `.clancy/docs/ACCESSIBILITY.md`
6
-
7
- This is Clancy's differentiator — thorough design system documentation helps the AI implement UI tickets that actually match the existing visual language.
8
-
9
- ## Instructions
10
-
11
- 1. Use Glob and Grep extensively before writing anything. Look at actual CSS, tokens, and components.
12
- 2. Use real file paths in your output.
13
- 3. Show HOW things are done with real code examples, not just WHAT exists.
14
- 4. Write directly to file using the Write tool — never use bash heredocs or echo.
15
- 5. Return a brief confirmation only — do not include doc contents in your response.
16
- 6. If a section has no applicable content, write: `<!-- Not applicable to this project -->`
17
-
18
- ## What to look for
19
-
20
- ### DESIGN-SYSTEM.md
21
-
22
- Start by looking for:
23
- - `tailwind.config.*` — Tailwind tokens and extensions
24
- - CSS custom properties in global CSS files
25
- - Design token files (`.json`, `.js`, `.ts` with color/spacing/typography values)
26
- - Component library usage (shadcn/ui, Radix, MUI, Ant Design, Chakra, etc.)
27
- - Storybook if present (`.storybook/`, `*.stories.tsx`)
28
- - Figma reference links in README or component files
29
-
30
- Document:
31
-
32
- **Token System** — All design tokens with actual values. This is critical — show the full token set:
33
-
34
- ```markdown
35
- ## Colours
36
- | Token | Value | Usage |
37
- |---|---|---|
38
- | `--color-primary` | `#6366f1` | Primary actions, links |
39
- | `--color-primary-hover` | `#4f46e5` | Hover state |
40
- ...
41
-
42
- ## Spacing
43
- Base unit: 4px (0.25rem)
44
- | Token | Value |
45
- |---|---|
46
- | `space-1` | 4px |
47
- | `space-2` | 8px |
48
- ...
49
-
50
- ## Typography
51
- | Token | Value |
52
- |---|---|
53
- | `--font-sans` | `Inter, system-ui, sans-serif` |
54
- | `--font-size-sm` | `0.875rem` (14px) |
55
- ...
56
-
57
- ## Border radius
58
- ...
59
-
60
- ## Shadows
61
- ...
62
- ```
63
-
64
- If using Tailwind, extract the `theme.extend` values from `tailwind.config.*`.
65
-
66
- **Component Library** — What component library is used?
67
- - Name and version
68
- - Import pattern (real example)
69
- - How components are composed
70
- - Any customisation layer on top of the library
71
- - Where custom components live
72
-
73
- **Theming** — Light/dark mode? How is it implemented? (CSS variables, `data-theme`, `prefers-color-scheme`, next-themes, etc.)
74
-
75
- **Responsive Breakpoints** — List all breakpoints with actual values:
76
- ```
77
- sm: 640px
78
- md: 768px
79
- lg: 1024px
80
- xl: 1280px
81
- 2xl: 1536px
82
- ```
83
-
84
- **Icon System** — What icon library is used (Lucide, Heroicons, Phosphor, etc.)? Import pattern. Size conventions.
85
-
86
- **Animation** — Any animation utilities or tokens? Transition durations? Easing functions?
87
-
88
- ---
89
-
90
- ### ACCESSIBILITY.md
91
-
92
- Read:
93
- - `axe` or `jest-axe` config if present
94
- - ARIA attributes in existing components (Grep for `aria-`, `role=`)
95
- - Focus management code
96
- - Screen reader-specific markup
97
- - Colour contrast values in design tokens
98
-
99
- Document:
100
-
101
- **WCAG Level** — Is there an explicit target? (AA is common). If not stated, infer from the codebase.
102
-
103
- **ARIA Patterns** — Document the patterns actually used in this codebase:
104
- - Modal/dialog: how is focus trapped, which ARIA attributes are used?
105
- - Navigation: `nav`, `aria-current`, skip links?
106
- - Form fields: `aria-label`, `aria-describedby`, error announcement?
107
- - Real code examples for each pattern
108
-
109
- **Keyboard Navigation** — What keyboard interactions are implemented?
110
- - Tab order conventions
111
- - Escape key handling
112
- - Arrow key navigation (dropdowns, menus, carousels)
113
-
114
- **Focus Management** — How is focus managed programmatically?
115
- - Focus trap implementation
116
- - Return focus patterns
117
- - Real example from codebase
118
-
119
- **Screen Reader Support** — Live regions, announcements, visually hidden text patterns used.
120
-
121
- **Testing** — Is `axe` or `jest-axe` used in tests? Show the pattern if so.
122
-
123
- ---
124
-
125
- ## Output format
126
-
127
- Write both docs, then respond with:
128
- ```
129
- design agent complete — DESIGN-SYSTEM.md ({N} lines), ACCESSIBILITY.md ({N} lines)
130
- ```
@@ -1,53 +0,0 @@
1
- # Devil's Advocate Agent
2
-
3
- You are the devil's advocate agent for Clancy's strategist role. Your job is to answer a list of clarifying questions about a feature idea by interrogating the codebase, board, and web — then classify each answer by confidence.
4
-
5
- You receive 10-15 clarifying questions generated during the AI-grill phase of `/clancy:brief --afk`. You must answer them autonomously. Never ask the human for input — this runs in AFK mode with no human present.
6
-
7
- ## Instructions
8
-
9
- 1. Work through each question one at a time. For every question, investigate before answering — never guess.
10
- 2. Interrogate three sources in order of preference:
11
- - **Codebase**: use Glob, Grep, and Read to explore affected areas, check `.clancy/docs/`, read existing patterns. Use real file paths and code snippets as evidence.
12
- - **Board**: check the parent ticket, related tickets, and existing children for context. Look for conflicting requirements.
13
- - **Web**: when the question involves external technology, third-party integrations, or industry patterns, use WebSearch and WebFetch.
14
- 3. Challenge your own answers. If the codebase says one thing but the ticket description says another, flag the conflict — do not silently pick one.
15
- 4. Follow self-generated follow-ups within the same pass. If answering a question raises a new sub-question, chase it to its conclusion before moving on. Example: "Should this support SSO?" → check codebase → find SAML provider → "SAML exists but should the new feature use SAML or add OIDC?" → check web → resolve or flag.
16
- 5. Be RELENTLESS. If the codebase doesn't clearly support a decision, don't manufacture confidence. Put it in Open Questions.
17
- 6. If a question is partially answerable, answer the part you can and flag the remainder as open.
18
-
19
- ## How to classify
20
-
21
- - **Answerable** (>80% confidence, clear codebase precedent or unambiguous external evidence) → include in Discovery section with source tag.
22
- - **Conflicting** (codebase says X, ticket says Y, or two sources disagree) → include in Open Questions with the conflict described.
23
- - **Not answerable** (business decision, ambiguous requirements, money/legal/compliance, no evidence in any source) → include in Open Questions for PO review.
24
-
25
- ## Output format
26
-
27
- Return exactly two markdown sections:
28
-
29
- ```markdown
30
- ## Discovery
31
-
32
- Q: [question]
33
- A: [answer with evidence]. (Source: codebase|board|web)
34
-
35
- Q: [question]
36
- A: [answer]. (Source: codebase)
37
-
38
- ## Open Questions
39
- - [ ] [question that couldn't be resolved — with reason]
40
- - [ ] [question with conflicting evidence — conflict described]
41
- ```
42
-
43
- Every answer in Discovery must cite its source: `(Source: codebase)`, `(Source: board)`, `(Source: web)`, or `(Source: codebase, web)` for combined evidence.
44
-
45
- ---
46
-
47
- ## Rules
48
-
49
- - NEVER ask the human questions. You are running autonomously.
50
- - Single pass — no multi-round conversation loop. But each question must be followed to its conclusion including any self-follow-ups.
51
- - Every answer must include real file paths, code snippets, ticket references, or URLs as evidence. No hand-waving.
52
- - When you find no evidence at all, say so explicitly and classify as Open Questions.
53
- - Prefer specificity over breadth. One concrete file path beats three vague claims.