hero-mmt-kit 1.0.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 (79) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/LICENSE +21 -0
  3. package/README.md +158 -0
  4. package/bin/hero-mmt-kit.js +70 -0
  5. package/package.json +35 -0
  6. package/presets/enterprise.json +3 -0
  7. package/presets/small-team.json +3 -0
  8. package/presets/solo.json +3 -0
  9. package/skills.manifest.json +72 -0
  10. package/src/detect.cjs +43 -0
  11. package/src/discover.cjs +159 -0
  12. package/src/doctor.cjs +130 -0
  13. package/src/init.cjs +114 -0
  14. package/src/integrations.cjs +93 -0
  15. package/src/links.cjs +37 -0
  16. package/src/merge.cjs +61 -0
  17. package/src/profile-config.cjs +28 -0
  18. package/src/render.cjs +27 -0
  19. package/src/skills.cjs +107 -0
  20. package/src/update.cjs +75 -0
  21. package/src/util.cjs +56 -0
  22. package/src/workflow-state.cjs +65 -0
  23. package/templates/.hero-mmt-kit/session.schema.json +15 -0
  24. package/templates/AGENTS.md.tmpl +16 -0
  25. package/templates/CLAUDE.md.tmpl +23 -0
  26. package/templates/common/.claude/hooks/git-guard.cjs +57 -0
  27. package/templates/common/.claude/hooks/session-bridge.cjs +43 -0
  28. package/templates/common/.claude/hooks/stop-reminder.cjs +43 -0
  29. package/templates/common/.claude/settings.json +27 -0
  30. package/templates/docs/ACTIVE_STATE.md +41 -0
  31. package/templates/docs/BROWNFIELD_DISCOVERY.md +45 -0
  32. package/templates/docs/DESIGN_STANDARDS.md +86 -0
  33. package/templates/docs/INTERACTION_PATTERNS.md +58 -0
  34. package/templates/docs/PERFORMANCE_STANDARDS.md +31 -0
  35. package/templates/docs/SECURITY_STANDARDS.md +38 -0
  36. package/templates/docs/templates/DESIGN_BRIEF.md +44 -0
  37. package/templates/docs/templates/PRD_AI_FEATURE.md +87 -0
  38. package/templates/skills/NOTICE +69 -0
  39. package/templates/skills/brainstorming/SKILL.md +161 -0
  40. package/templates/skills/brainstorming/scripts/frame-template.html +214 -0
  41. package/templates/skills/brainstorming/scripts/helper.js +88 -0
  42. package/templates/skills/brainstorming/scripts/server.cjs +354 -0
  43. package/templates/skills/brainstorming/scripts/start-server.sh +148 -0
  44. package/templates/skills/brainstorming/scripts/stop-server.sh +56 -0
  45. package/templates/skills/brainstorming/spec-document-reviewer-prompt.md +49 -0
  46. package/templates/skills/brainstorming/visual-companion.md +287 -0
  47. package/templates/skills/dispatching-parallel-agents/SKILL.md +186 -0
  48. package/templates/skills/executing-plans/SKILL.md +72 -0
  49. package/templates/skills/finishing-a-development-branch/SKILL.md +253 -0
  50. package/templates/skills/hero-coding/SKILL.md +69 -0
  51. package/templates/skills/hero-planning/SKILL.md +64 -0
  52. package/templates/skills/hero-reviewing/SKILL.md +66 -0
  53. package/templates/skills/hero-security/SKILL.md +425 -0
  54. package/templates/skills/hero-strict/SKILL.md +77 -0
  55. package/templates/skills/hero-unit-test/SKILL.md +79 -0
  56. package/templates/skills/receiving-code-review/SKILL.md +213 -0
  57. package/templates/skills/requesting-code-review/SKILL.md +108 -0
  58. package/templates/skills/requesting-code-review/code-reviewer.md +168 -0
  59. package/templates/skills/subagent-driven-development/SKILL.md +269 -0
  60. package/templates/skills/subagent-driven-development/code-quality-reviewer-prompt.md +34 -0
  61. package/templates/skills/subagent-driven-development/implementer-prompt.md +121 -0
  62. package/templates/skills/subagent-driven-development/scripts/review-package.sh +38 -0
  63. package/templates/skills/subagent-driven-development/scripts/sdd-workspace.sh +25 -0
  64. package/templates/skills/subagent-driven-development/scripts/task-brief.sh +58 -0
  65. package/templates/skills/subagent-driven-development/spec-reviewer-prompt.md +76 -0
  66. package/templates/skills/systematic-debugging/SKILL.md +296 -0
  67. package/templates/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
  68. package/templates/skills/systematic-debugging/condition-based-waiting.md +115 -0
  69. package/templates/skills/systematic-debugging/defense-in-depth.md +122 -0
  70. package/templates/skills/systematic-debugging/find-polluter.sh +63 -0
  71. package/templates/skills/systematic-debugging/root-cause-tracing.md +169 -0
  72. package/templates/skills/test-driven-development/SKILL.md +371 -0
  73. package/templates/skills/test-driven-development/testing-anti-patterns.md +299 -0
  74. package/templates/skills/using-git-worktrees/SKILL.md +206 -0
  75. package/templates/skills/using-hero/SKILL.md +54 -0
  76. package/templates/skills/using-superpowers/SKILL.md +119 -0
  77. package/templates/skills/verification-before-completion/SKILL.md +139 -0
  78. package/templates/skills/writing-plans/SKILL.md +173 -0
  79. package/templates/skills/writing-plans/plan-document-reviewer-prompt.md +49 -0
package/src/util.cjs ADDED
@@ -0,0 +1,56 @@
1
+ 'use strict';
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const readline = require('readline');
5
+
6
+ const C = { reset: '\x1b[0m', dim: '\x1b[2m', red: '\x1b[31m', green: '\x1b[32m', yellow: '\x1b[33m', cyan: '\x1b[36m', bold: '\x1b[1m' };
7
+ const useColor = process.stdout.isTTY && !process.env.NO_COLOR;
8
+ function c(col, s) { return useColor ? col + s + C.reset : s; }
9
+
10
+ const log = {
11
+ info: (m) => console.log(m),
12
+ step: (m) => console.log(c(C.cyan, '» ') + m),
13
+ ok: (m) => console.log(c(C.green, '✓ ') + m),
14
+ warn: (m) => console.log(c(C.yellow, '⚠ ') + m),
15
+ err: (m) => console.error(c(C.red, '✗ ') + m),
16
+ title: (m) => console.log('\n' + c(C.bold, m)),
17
+ };
18
+
19
+ function ensureDir(d) { fs.mkdirSync(d, { recursive: true }); }
20
+ function exists(p) { try { fs.accessSync(p); return true; } catch (_) { return false; } }
21
+ function readJSON(p, fallback) { try { return JSON.parse(fs.readFileSync(p, 'utf8')); } catch (_) { return fallback; } }
22
+ function writeJSON(p, obj) { ensureDir(path.dirname(p)); fs.writeFileSync(p, JSON.stringify(obj, null, 2) + '\n'); }
23
+ function backup(p) { if (exists(p)) { const b = p + '.bak'; fs.copyFileSync(p, b); return b; } return null; }
24
+
25
+ // Interactive asker. When `auto` is true (--yes / non-interactive), never prompts: returns defaults.
26
+ function makeAsker(auto) {
27
+ let rl = null;
28
+ function q(question) {
29
+ if (auto) return Promise.resolve('');
30
+ if (!rl) rl = readline.createInterface({ input: process.stdin, output: process.stdout });
31
+ return new Promise((res) => rl.question(question, (a) => res(a)));
32
+ }
33
+ async function text(label, def) {
34
+ const a = (await q(`${label}${def ? ` [${def}]` : ''}: `)).trim();
35
+ return a || def || '';
36
+ }
37
+ async function yesno(label, defYes) {
38
+ if (auto) return defYes;
39
+ const a = (await q(`${label} ${defYes ? '[Y/n]' : '[y/N]'}: `)).trim().toLowerCase();
40
+ if (!a) return defYes;
41
+ return a === 'y' || a === 'yes';
42
+ }
43
+ async function choice(label, opts, defIdx) {
44
+ defIdx = defIdx || 0;
45
+ if (auto) return opts[defIdx];
46
+ console.log(label);
47
+ opts.forEach((o, i) => console.log(` ${i + 1}) ${o}`));
48
+ const a = (await q(`Choose [${defIdx + 1}]: `)).trim();
49
+ const i = parseInt(a, 10);
50
+ return (i >= 1 && i <= opts.length) ? opts[i - 1] : opts[defIdx];
51
+ }
52
+ function close() { if (rl) rl.close(); }
53
+ return { text, yesno, choice, close };
54
+ }
55
+
56
+ module.exports = { C, c, log, ensureDir, exists, readJSON, writeJSON, backup, makeAsker };
@@ -0,0 +1,65 @@
1
+ 'use strict';
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
5
+ const SESSION_FILE = path.join('.hero-mmt-kit', 'session.json');
6
+
7
+ function defaultSession() {
8
+ return {
9
+ schemaVersion: 1,
10
+ currentSkill: null,
11
+ lastCheckpoint: null,
12
+ resumePath: null,
13
+ nextAction: null,
14
+ updatedAt: null,
15
+ };
16
+ }
17
+
18
+ const STRING_OR_NULL_FIELDS = ['currentSkill', 'lastCheckpoint', 'resumePath', 'nextAction', 'updatedAt'];
19
+
20
+ function validateSession(obj) {
21
+ const errors = [];
22
+ if (!obj || typeof obj !== 'object') { errors.push('session must be an object'); return { ok: false, errors }; }
23
+ if (obj.schemaVersion !== 1) errors.push(`schemaVersion must be 1, got ${obj.schemaVersion}`);
24
+ for (const key of STRING_OR_NULL_FIELDS) {
25
+ if (Object.prototype.hasOwnProperty.call(obj, key) && obj[key] !== null && typeof obj[key] !== 'string') {
26
+ errors.push(`${key} must be a string or null, got "${obj[key]}"`);
27
+ }
28
+ }
29
+ return { ok: errors.length === 0, errors };
30
+ }
31
+
32
+ function readSession(target) {
33
+ const filePath = path.join(target, SESSION_FILE);
34
+ if (!fs.existsSync(filePath)) return null;
35
+ try {
36
+ const raw = fs.readFileSync(filePath, 'utf8');
37
+ const parsed = JSON.parse(raw);
38
+ return parsed;
39
+ } catch {
40
+ return null;
41
+ }
42
+ }
43
+
44
+ function writeSession(target, partial) {
45
+ const filePath = path.join(target, SESSION_FILE);
46
+ const existing = readSession(target) || defaultSession();
47
+ const merged = deepMergeSession(existing, partial);
48
+ fs.mkdirSync(path.dirname(filePath), { recursive: true });
49
+ fs.writeFileSync(filePath, JSON.stringify(merged, null, 2) + '\n');
50
+ return merged;
51
+ }
52
+
53
+ function deepMergeSession(base, partial) {
54
+ const out = Object.assign({}, base);
55
+ for (const [k, v] of Object.entries(partial)) {
56
+ if (v !== null && typeof v === 'object' && !Array.isArray(v) && typeof base[k] === 'object' && base[k] !== null) {
57
+ out[k] = deepMergeSession(base[k], v);
58
+ } else {
59
+ out[k] = v;
60
+ }
61
+ }
62
+ return out;
63
+ }
64
+
65
+ module.exports = { defaultSession, validateSession, readSession, writeSession };
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "hero-mmt-kit session state",
4
+ "description": "Observable workflow pointer for resuming work across sessions. Hero skills update this at checkpoints; doctor reads it. Authoritative state lives in ACTIVE_STATE.md and artifact files under docs/ — this file is a derived convenience pointer.",
5
+ "type": "object",
6
+ "required": ["schemaVersion"],
7
+ "properties": {
8
+ "schemaVersion": { "type": "integer", "const": 1 },
9
+ "currentSkill": { "type": ["string", "null"], "description": "Name of the hero-* skill currently in progress" },
10
+ "lastCheckpoint": { "type": ["string", "null"], "description": "ISO 8601 timestamp of the last session write" },
11
+ "resumePath": { "type": ["string", "null"], "description": "Path to the artifact/report to resume from" },
12
+ "nextAction": { "type": ["string", "null"], "description": "First concrete action for continuing the work" },
13
+ "updatedAt": { "type": ["string", "null"], "description": "ISO 8601 timestamp of the last update" }
14
+ }
15
+ }
@@ -0,0 +1,16 @@
1
+ # Agent Instructions
2
+
3
+ > This is a human-led Claude Code workflow: the developer decides what to work on and invokes the relevant skill directly. Use `using-hero` for the overview when it's unclear which skill applies next.
4
+
5
+ Core Hero skills: `hero-planning`, `hero-coding`, `hero-reviewing`, `hero-unit-test`, `hero-security`, `hero-strict`.
6
+
7
+ Minimum non-negotiables:
8
+ 1. Use `using-hero` to pick the right skill; don't run heavy process for small tasks.
9
+ 2. **Resume (fast path):** read `.hero-mmt-kit/session.json` first → then the `resumePath` it names → then the latest artifact. Read [ACTIVE_STATE](docs/ACTIVE_STATE.md) only to switch work items or when session is blank/stale.
10
+ 3. Use Plan Mode for risky or hard-to-reverse changes before editing.
11
+ 4. Read only the docs the current skill needs; avoid loading unrelated context.
12
+ 5. Framework instructions, skills, rules, and templates are English-only; respond to the user in the same language they use in chat unless they request another language.
13
+ 6. Do not bypass hooks, checks, or verification.
14
+ 7. Use GitNexus for impact/context analysis on non-trivial code changes when available.
15
+ 8. Sub-agent delegation is optional, not automatic — use it for research and review when it helps; not every task needs one. Don't hardcode model IDs.
16
+ 9. Keep outputs concise: findings, decisions, risks, next steps.
@@ -0,0 +1,23 @@
1
+ ## 🧭 hero-mmt-kit workflow
2
+
3
+ > This is a human-led Claude Code workflow: you (the developer) decide what to work on and invoke the relevant skill directly. There is no router doc and no hard gate — use `using-hero` for the overview when it's unclear which skill applies next.
4
+
5
+ Core Hero skills:
6
+ - `hero-planning` — turn a request into an agreed, written plan before code changes.
7
+ - `hero-coding` — implement an approved plan (or a small change that doesn't need one).
8
+ - `hero-reviewing` — fresh-eyes check of an implementation against its plan, before merge.
9
+ - `hero-unit-test` — verify correctness, TDD-first or post-implementation.
10
+ - `hero-security` — standalone OWASP + AI/LLM security review when you want a dedicated security pass.
11
+ - `hero-strict` — opt-in full verification pass before a "done" claim.
12
+
13
+ ### Context loading
14
+ - **Resume (fast path):** read `.hero-mmt-kit/session.json` first → then the `resumePath` it names → then the latest artifact only if needed. Read [ACTIVE_STATE](docs/ACTIVE_STATE.md) only to switch work items or when session is blank/stale.
15
+ - **Read on demand:** [SECURITY_STANDARDS](docs/SECURITY_STANDARDS.md), [PERFORMANCE_STANDARDS](docs/PERFORMANCE_STANDARDS.md), [DESIGN_STANDARDS](docs/DESIGN_STANDARDS.md), [BROWNFIELD_DISCOVERY](docs/BROWNFIELD_DISCOVERY.md), and templates under `docs/templates/` only when the current skill requires them.
16
+
17
+ ### Non-negotiables
18
+ - **Gates:** for risky or hard-to-reverse changes, use Plan Mode (`EnterPlanMode` → `ExitPlanMode`) for real sign-off — not a prose promise.
19
+ - **Enforcement:** hooks installed under `.claude/` — `git-guard` (PreToolUse on Bash), `session-bridge` (PostToolUse), `stop-reminder` (Stop). Don't bypass them.
20
+ - **GitNexus (if installed):** skip on empty repos; use impact/context analysis for non-trivial code changes and stale-index checks.
21
+ - **Skills (if installed):** invoke relevant process skills via the `Skill` tool; do not load unrelated skill/docs context.
22
+ - **Language:** framework instructions, skills, rules, and templates are English-only. Respond to the user in the same language they use in chat unless they request another language.
23
+ - **Sub-agent delegation is optional, not automatic.** Sub-agents are best for research and review; use one when it helps, and skip it when direct work is clearer. Don't hardcode model IDs — let the harness resolve the active model.
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /*
4
+ * Shell git guard — Claude Code PreToolUse (matcher: Bash) — { tool_name, tool_input:{command} }
5
+ * BLOCKS dangerous git commands (exit 2).
6
+ * REMINDS on commits without blocking (exit 0, stderr -> user).
7
+ */
8
+ let raw = '';
9
+ process.stdin.on('data', (d) => { raw += d; });
10
+ process.stdin.on('end', () => {
11
+ let payload = {};
12
+ try { payload = JSON.parse(raw || '{}'); } catch (_) { process.exit(0); }
13
+
14
+ const cmd = (payload.tool_input && payload.tool_input.command) || '';
15
+ if (!cmd) process.exit(0);
16
+ if (payload.tool_name && payload.tool_name !== 'Bash') process.exit(0);
17
+ if (!/\bgit\b/.test(cmd)) process.exit(0);
18
+
19
+ const block = (msg) => {
20
+ console.error('⛔ [git-guard] ' + msg);
21
+ process.exit(2);
22
+ };
23
+
24
+ const isPush = /\bpush\b/.test(cmd);
25
+ const isCommit = /\bcommit\b/.test(cmd);
26
+
27
+ // 1) Force push (allow --force-with-lease)
28
+ if (isPush && /(--force(?!-with-lease)|(^|\s)-f(\s|$))/.test(cmd)) {
29
+ block('Blocked force-push (--force/-f). If truly needed, use --force-with-lease and confirm manually. ' +
30
+ '`main` is protected — send changes through a Merge Request.');
31
+ }
32
+
33
+ // 2) commit --no-verify / -n (bypasses hooks/CI)
34
+ if (isCommit && /(--no-verify|(^|\s)-n(\s|$))/.test(cmd)) {
35
+ block('Blocked `git commit --no-verify`: do not bypass hooks/checks unless the User explicitly requests it.');
36
+ }
37
+
38
+ // 3) reset --hard (can discard changes)
39
+ if (/\breset\b[\s\S]*--hard/.test(cmd)) {
40
+ block('Blocked `git reset --hard` (it can discard changes). Consider `git stash`, or run it manually if you truly intend it.');
41
+ }
42
+
43
+ // 4) direct push to main (standalone "main" token or :main refspec)
44
+ if (isPush && /(^|\s|:)main(\s|$)/.test(cmd) && !/--dry-run/.test(cmd)) {
45
+ block('Blocked direct push to protected `main`. Create a branch + Merge Request.');
46
+ }
47
+
48
+ // REMIND (non-blocking) on commit
49
+ if (isCommit) {
50
+ console.error('🔔 [git-guard] Before committing, check: ' +
51
+ '(1) docs/ACTIVE_STATE.md updated? ' +
52
+ '(2) gitnexus_detect_changes run when code changed? ' +
53
+ '(3) Conventional Commits message?');
54
+ }
55
+
56
+ process.exit(0);
57
+ });
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /*
4
+ * session-bridge.cjs — one-time session context injector (v1.0.0)
5
+ * Claude Code: PostToolUse (matcher: .*)
6
+ *
7
+ * On the first tool call of the session, reads session.json and emits
8
+ * current workflow state to stderr. Guarded by a flag file so it only
9
+ * fires once per session. Flag is cleaned up by stop-reminder.cjs.
10
+ */
11
+ const fs = require('fs');
12
+ const path = require('path');
13
+
14
+ let raw = '';
15
+ process.stdin.on('data', (d) => { raw += d; });
16
+ process.stdin.on('end', () => {
17
+ let payload = {};
18
+ try { payload = JSON.parse(raw || '{}'); } catch (_) { process.exit(0); }
19
+
20
+ const cwd = (payload && payload.cwd) || process.cwd();
21
+ const flagPath = path.join(cwd, '.hero-mmt-kit', 'session-injected.flag');
22
+ const sessionPath = path.join(cwd, '.hero-mmt-kit', 'session.json');
23
+
24
+ if (fs.existsSync(flagPath)) process.exit(0);
25
+
26
+ let session;
27
+ try { session = JSON.parse(fs.readFileSync(sessionPath, 'utf8')); } catch (_) { process.exit(0); }
28
+ if (!session || typeof session !== 'object') process.exit(0);
29
+
30
+ const sep = '─'.repeat(55);
31
+ process.stderr.write([
32
+ sep,
33
+ '[hero-mmt-kit] Session state (auto-injected)',
34
+ ` Current skill : ${session.currentSkill ?? '(none)'}`,
35
+ ` Resume path : ${session.resumePath ?? '(not set)'}`,
36
+ ` Next action : ${session.nextAction ?? '(none)'}`,
37
+ sep,
38
+ ].join('\n') + '\n');
39
+
40
+ try { fs.writeFileSync(flagPath, ''); } catch (_) { /* best-effort */ }
41
+
42
+ process.exit(0);
43
+ });
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ /*
4
+ * Stop hook — soft reminder (non-blocking, exit 0).
5
+ * Claude Code: Stop — { hook_event_name, stop_hook_active, cwd }
6
+ * If there are uncommitted changes and docs/ACTIVE_STATE.md was not touched,
7
+ * print a reminder for the user. Do NOT block stopping (no exit 2 -> avoid loops).
8
+ */
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+ const { execSync } = require('child_process');
12
+
13
+ function cleanupSessionFlag(cwd) {
14
+ const flagPath = path.join(cwd, '.hero-mmt-kit', 'session-injected.flag');
15
+ try { fs.rmSync(flagPath, { force: true }); } catch (_) {}
16
+ }
17
+
18
+ let raw = '';
19
+ process.stdin.on('data', (d) => { raw += d; });
20
+ process.stdin.on('end', () => {
21
+ let payload = {};
22
+ try { payload = JSON.parse(raw || '{}'); } catch (_) { /* ignore */ }
23
+ if (payload.stop_hook_active) process.exit(0); // loop guard
24
+
25
+ const cwd = payload.cwd || process.cwd();
26
+ let status = '';
27
+ try {
28
+ status = execSync('git status --porcelain', { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] });
29
+ } catch (_) { cleanupSessionFlag(cwd); process.exit(0); }
30
+
31
+ const lines = status.split('\n').map((l) => l.trim()).filter(Boolean);
32
+ if (lines.length === 0) { cleanupSessionFlag(cwd); process.exit(0); } // no changes
33
+
34
+ const stateTouched = lines.some((l) => /ACTIVE_STATE\.md$/.test(l));
35
+ const otherChanged = lines.some((l) => !/ACTIVE_STATE\.md$/.test(l));
36
+
37
+ if (otherChanged && !stateTouched) {
38
+ console.error('🔔 [stop-reminder] There are uncommitted changes, but docs/ACTIVE_STATE.md was not updated. ' +
39
+ 'If work state changed, update the Active Features table and Session Resume Protocol.');
40
+ }
41
+ cleanupSessionFlag(cwd);
42
+ process.exit(0);
43
+ });
@@ -0,0 +1,27 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Bash",
6
+ "hooks": [
7
+ { "type": "command", "command": "node .claude/hooks/git-guard.cjs" }
8
+ ]
9
+ }
10
+ ],
11
+ "PostToolUse": [
12
+ {
13
+ "matcher": ".*",
14
+ "hooks": [
15
+ { "type": "command", "command": "node .claude/hooks/session-bridge.cjs" }
16
+ ]
17
+ }
18
+ ],
19
+ "Stop": [
20
+ {
21
+ "hooks": [
22
+ { "type": "command", "command": "node .claude/hooks/stop-reminder.cjs" }
23
+ ]
24
+ }
25
+ ]
26
+ }
27
+ }
@@ -0,0 +1,41 @@
1
+ # Project Active State
2
+
3
+ **Last Updated:** {{DATE}}
4
+ **Current Global Phase:** 0 — Initialization & Setup
5
+
6
+ > 📌 **The "Active Features" table below IS the durable cross-session backlog.** It is the primary source of state when resuming.
7
+ > `TaskCreate`/`TaskList` only live **within the current session** (in-memory, lost when the session closes) — use them to track current work, NOT as a long-term backlog. Whenever a feature's status changes → update this table and the corresponding MR/issue (if any).
8
+
9
+ ## Active Features in Pipeline
10
+
11
+ | Feature / Epic | Path | Current phase | Branch / MR | Status | PRD | TDD |
12
+ | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
13
+ | N/A | N/A | N/A | - | Idle | - | - |
14
+
15
+ ## Blockers / Pending Actions
16
+ - Waiting for the Product Owner to propose the first feature/idea.
17
+ - Decide the tech stack → fill the `<TBD>` placeholders in [SECURITY_STANDARDS.md](./SECURITY_STANDARDS.md) and [PERFORMANCE_STANDARDS.md](./PERFORMANCE_STANDARDS.md).
18
+ - Decide the design direction → follow [DESIGN_STANDARDS.md](./DESIGN_STANDARDS.md) §2.
19
+
20
+ ## Context budget discipline
21
+ This file is an index, not a report. Keep it short enough to read at session start.
22
+
23
+ Keep here:
24
+ - active goals and current phase/status,
25
+ - open blockers and next actions,
26
+ - decisions that still affect current work,
27
+ - links to canonical PRDs, TDDs, reports, MRs, issues, or archived notes.
28
+
29
+ Do not paste long investigation notes, transcripts, screenshots, logs, PRDs, or completed reports here. Summarize in 1–2 lines and link the source. When work is no longer active, archive durable details under `docs/reports/` (or the canonical artifact path) and replace the table entry with a short link if future agents may need it.
30
+
31
+ ## Session Resume Protocol
32
+
33
+ `session.json` vs `ACTIVE_STATE.md`:
34
+ - `.hero-mmt-kit/session.json` — a small derived pointer (`currentSkill`, `lastCheckpoint`, `resumePath`, `nextAction`). Read it first on resume; it is the fast path.
35
+ - `ACTIVE_STATE.md` — the durable backlog index. Read it when switching work items or when session.json is absent/stale.
36
+
37
+ *An AI starting or resuming tracked work READS in this order:*
38
+ 1. **Read `.hero-mmt-kit/session.json`** (~100 tokens) → get `currentSkill`, `resumePath`, `nextAction`. If populated and not stale, go directly to step 2.
39
+ 2. **Read the `resumePath`** it names (the latest artifact/report) → concrete next action.
40
+ 3. **Only if you need to switch work or session.json is blank/stale:** read the "Active Features" table above + any **open MRs** (`git branch`, MR list).
41
+ 4. Update this table when durable work state changes. When a work item completes, replace the row with a one-line link to the artifact.
@@ -0,0 +1,45 @@
1
+ # Brownfield Discovery
2
+
3
+ Use this when the project already has code and may have partial, outdated, or non-standard documentation.
4
+
5
+ ## When to run
6
+
7
+ For an existing project that has never used hero-mmt-kit:
8
+
9
+ ```bash
10
+ npx hero-mmt-kit init
11
+ npx hero-mmt-kit discover
12
+ npx hero-mmt-kit doctor
13
+ ```
14
+
15
+ `init` installs the workflow. `discover` scans the current repo and creates `docs/BROWNFIELD_DISCOVERY.md` with the first evidence map.
16
+
17
+ ## What the AI must do after `discover`
18
+
19
+ 1. Read `docs/BROWNFIELD_DISCOVERY.md` first.
20
+ 2. Start with the summary and **Read next** list; do not load every discovered doc/config by default.
21
+ 3. Read only the docs/config/code needed for the selected task path, then expand context if evidence is insufficient.
22
+ 4. Record findings with certainty labels:
23
+ - **Found** — directly observed in files.
24
+ - **Likely** — inferred from names/structure, not yet proven.
25
+ - **Needs confirmation** — requires the human or missing business context.
26
+ 5. For the first code changes after discovery, use `using-hero` to pick the right skill. If it touches > 2 files or any **Needs confirmation** area, use Plan Mode (`hero-planning`) + impact analysis before implementing, and choose the review budget from actual risk and uncertainty.
27
+
28
+ ## Context discipline
29
+
30
+ - Do not assume docs live in `docs/`.
31
+ - Do not assume missing docs mean missing behavior.
32
+ - Do not assume a folder name proves its role before reading files.
33
+ - Do not claim a command passes until it has been run.
34
+ - Do not paste long source excerpts into the report; use file paths, short evidence notes, and links to artifacts.
35
+
36
+ ## Output expected from the first AI pass
37
+
38
+ Update the discovery report or create a report under `docs/reports/` with a summary-first structure:
39
+
40
+ 1. **Summary** — project purpose, important flows, and likely architecture in 3–6 bullets.
41
+ 2. **Read next** — prioritized files/docs/configs with one-line reasons.
42
+ 3. **Evidence map** — key paths and what was found there.
43
+ 4. **Verification commands** — commands observed or proven, clearly labeled.
44
+ 5. **Risks / unknowns** — areas needing confirmation before edits.
45
+ 6. **Open questions** — only questions that block safe next steps.
@@ -0,0 +1,86 @@
1
+ # Design Standards — UI/UX
2
+
3
+ > **Standards & how-to for UI/UX.** This file holds *standards, skill routing, design profiles, media, and in-product help* — NOT process sequencing. For *when* each step happens, see `using-hero` and `hero-planning`. Per-project specifics are locked as `<TBD>` in the PRD / Design Brief.
4
+
5
+ ## §1 UX ↔ UI (two layers)
6
+ - **UX (problem space):** user personas, primary flows, information architecture, screen inventory, per-screen states (empty / loading / error / success / partial).
7
+ - **UI (solution surface):** brand, one locked visual direction, design tokens, component system.
8
+
9
+ ## §2 Design profiles — fit the product
10
+ Pick **one** profile per project (decided in the first PRD/TDD), record it in `docs/design/DESIGN_SYSTEM.md`. The profile sets the *creativity × discipline* balance and which steps are required vs skippable.
11
+
12
+ | Profile | Typical product | Creativity | Discipline | Brand & media | Required steps | Skippable |
13
+ |---|---|---|---|---|---|---|
14
+ | **system-strict** | internal tools, CRUD, B2B admin | low | very high | minimal; standard icon set, no bespoke media | one locked token set (lean direction, e.g. `minimalist-ui`), strict layout/spacing, component reuse, a11y, consistency QA | brand exploration, imagegen exploration, custom media |
15
+ | **branded-product** | end-user SaaS / productivity apps | medium | high | brand tokens + selective bespoke media (empty-states, key illustrations) | direction gate, design system, imagegen for key screens, selective media | heavy marketing media, per-section creative gates |
16
+ | **expressive** | consumer, marketing/landing, brand-forward | high | consistent | full brand + rich embedded media + motion | brand, direction exploration, media production, design system, per-section visual review, media-perf QA | — |
17
+
18
+ Default when the product type is unknown: **branded-product**, confirmed at the gate.
19
+
20
+ ## §3 Design skill routing — job → skill
21
+ > Install via the `skills` CLI per `skills.manifest.json` groups. **Pick exactly ONE visual direction** and lock it.
22
+ >
23
+ > **Availability caveat:** in `skills.manifest.json`, `gpt-taste` (design-direction) and all of `design-tools` (`imagegen-frontend-web`, `imagegen-frontend-mobile`, `image-to-code`, `redesign-existing-projects`) currently have `"source": "<TBD>"` — no installable source is wired yet. Before routing to any of these, verify with the `skills` CLI that the skill actually installed; if it didn't, fall back to a skill with a real source (e.g. `design-taste-frontend`, `minimalist-ui`) or do the step manually. Do not assume the row below means the skill is installable today.
24
+
25
+ | Need | Skill | When |
26
+ |---|---|---|
27
+ | Brand / identity (logo, brand board) | `brandkit` | New product/brand or rebrand. Once. (branded-product / expressive) |
28
+ | **Lock a visual direction — PICK ONE** | one of `design-taste-frontend` · `minimalist-ui` · `industrial-brutalist-ui` · `high-end-visual-design` · `gpt-taste` | At the Phase-2 gate. Exactly one, then locked. |
29
+ | Generate reference images (web) | `imagegen-frontend-web` | Explore/lock the look per section before coding. |
30
+ | Generate reference images (mobile) | `imagegen-frontend-mobile` | Mobile screen exploration. |
31
+ | Turn an approved design image into code | `image-to-code` | Implementing from an approved visual reference. |
32
+ | Redesign / audit an existing UI | `redesign-existing-projects` | Router row #9 on existing surfaces. |
33
+ | Interactive wireframes / A-B visual choices | `brainstorming` + visual companion | UX wireframing and layout selection. |
34
+
35
+ **Pick a direction by vibe:** `minimalist-ui` = clean editorial · `industrial-brutalist-ui` = raw mechanical/terminal · `high-end-visual-design` = expensive agency feel · `gpt-taste` = editorial + GSAP motion · `design-taste-frontend` = anti-slop general default.
36
+
37
+ ## §4 Design tokens & system
38
+ - Tokens are the **single source of truth**: color, type scale, spacing, radius, shadow, motion.
39
+ - **No hardcoded design values** in components — reference tokens.
40
+ - Name tokens consistently (semantic over literal, e.g. `color-surface` not `gray-100`).
41
+ - **Pick exactly one direction** for the project; do not mix design skills within one feature.
42
+
43
+ ## §5 Platform
44
+ - Declare scope per project: web-only / mobile-only / web+mobile.
45
+ - **One shared token source is canonical.** Platform layers add platform-specific patterns:
46
+ - **Web:** responsive breakpoints, hover/focus, pointer + keyboard.
47
+ - **Mobile:** native navigation, platform conventions (HIG / Material), touch targets, safe areas.
48
+ - Routing: `imagegen-frontend-web` vs `imagegen-frontend-mobile`.
49
+
50
+ ## §6 Media / asset production
51
+ Beyond CSS, products often need embedded media.
52
+ - **Asset types:** icons, illustrations, photography/hero imagery, OG/social share images, diagrams, help/onboarding visuals (annotated screenshots, GIF/short video — see §8), optional short motion (lottie/video).
53
+ - **Render paths:**
54
+ 1. A **configured AI media provider** (provider-agnostic; API key from the consumer's environment) for higher-fidelity raster/illustration. Configure via `hero-mmt-kit init` (stores provider + env-var name only).
55
+ 2. **Claude-subagent fallback** (`imagegen-frontend-web/mobile`, `brandkit`) when no provider is configured — produces references, mockups, prompts, and within-capability assets.
56
+ - **Storage:** source/reference & exploration → `docs/design/assets/` (durable, reviewable; keep small — large raw files under a gitignored path); production-ready optimized assets → the app's own asset directory (`<TBD>`).
57
+ - **Asset DoD:** optimized/compressed, right format (SVG/WebP/AVIF where apt), rights-clear/licensed, alt text, responsive `srcset` where apt.
58
+
59
+ ## §7 Visual QA checklist
60
+ - Responsive across declared breakpoints.
61
+ - a11y **WCAG AA** baseline: contrast, visible focus, keyboard navigation, alt text, semantic landmarks.
62
+ - All states covered (empty/loading/error/success/partial).
63
+ - Cross-browser; dark mode (if applicable); `prefers-reduced-motion` respected.
64
+ - Media weight within the [PERFORMANCE_STANDARDS.md](./PERFORMANCE_STANDARDS.md) budget.
65
+
66
+ ## §8 In-product help & onboarding
67
+ Every product with a UI ships an in-product help surface on a **secondary** surface (under a `?` icon / settings / footer — never the primary functional nav).
68
+ - **Pattern library (standardize 4):**
69
+ 1. **Dedicated Help/Guide page** — its own section in secondary nav, table of contents by task.
70
+ 2. **First-run onboarding** — tour/coachmarks, skippable and replayable.
71
+ 3. **Contextual help** — tooltips, inline hints, empty-state guidance where the user needs it.
72
+ 4. **FAQ / troubleshooting** — common questions + error resolution, searchable.
73
+ - **Depth by profile:** `system-strict` = structured text + screenshots; `branded-product` = + annotated images + empty-state hints; `expressive` = + onboarding tour + GIF/short video.
74
+ - **Content source:** authored as Markdown/MDX in `docs/help/` (versioned, reviewable), rendered in-app; mirrors the project language(s); follows the §7 a11y baseline.
75
+ - **Sync rule:** a feature with user-facing impact is **not done** until its help entry exists and is accurate.
76
+
77
+ ## §9 Artifacts
78
+ Design artifacts and their storage: UX spec (in the PRD), `docs/design/DESIGN_SYSTEM.md`, `docs/design/assets/`, `docs/help/`, and the Visual QA report (part of `hero-reviewing`'s output).
79
+
80
+ ## §10 References-first (avoid AI-slop)
81
+ - AI interfaces look generic mainly because no real references were given. Gather references **before** generating.
82
+ - Collect 3–5 real references (Dribbble, Mobbin, Behance, Muzli); paste/link them and **name the products** in the Design Brief. Note what specifically you want from each (layout, type, color, motion).
83
+ - Generate multiple variations and compare; then lock exactly one direction (see §4 token/lock rules).
84
+ - Avoid LLM defaults: AI-purple gradients, centered hero over dark mesh, three equal feature cards, generic glassmorphism, Inter + slate-900 everywhere.
85
+ - **Optional design MCP** (license-respecting, not bundled): a browser MCP (Chrome/Playwright) to capture references and validate the built UI via screenshots; a Figma MCP to turn an existing Figma design into code. Provider-agnostic, like media generation (§6).
86
+ - **Optional storytelling layer** (expressive profile): give the page a narrative — scroll-story, parallax, sequenced reveals. Record the intent briefly in `docs/design/design-story.md`; keep effects tasteful and within the performance budget (§7).
@@ -0,0 +1,58 @@
1
+ # Interaction Patterns — Assistant ↔ End-User (Product Layer)
2
+
3
+ > A library of **patterns for how the PRODUCT talks to end-users** — distinct from how the developer and the AI communicate during development. This is how the *built assistant* talks to *end-users*.
4
+ >
5
+ > A **reusable asset**: each AI-feature PRD (§3, §5, §8 of the [template](./templates/PRD_AI_FEATURE.md)) references these patterns instead of redesigning from scratch. Specific thresholds/details (`<TBD>`) are locked per PRD.
6
+
7
+ ## Foundational principles
8
+ 1. **The user stays in control** — the assistant assists; it doesn't unilaterally make hard-to-reverse decisions for the user.
9
+ 2. **Be transparent about limits** — say clearly when unsure, when it doesn't know, or when it can't do something; never fabricate.
10
+ 3. **Error cost shapes behavior** — low-risk actions → just do them; high-risk/hard-to-reverse → confirm first.
11
+
12
+ ---
13
+
14
+ ## P1 — Clarification (clarifying intent)
15
+ - **When to ask back:** ambiguous intent, missing required parameters, or multiple interpretations leading to very different results.
16
+ - **When NOT to ask:** there's a safe/clear default → just do it and **state the assumption** ("I understood it as X, let me know if that's wrong").
17
+ - **How to ask:** one focused question, with 2–4 options if possible; don't torture the user with a chain of questions.
18
+ - **Threshold:** at most `<TBD>` questions before giving a best-effort attempt.
19
+
20
+ ## P2 — Confirmation (confirm before acting)
21
+ - **Confirmation required** before actions that are: hard to reverse, affect data/money/other people, or go outward (send email, publish…).
22
+ - **Not needed** for read-only/non-destructive actions.
23
+ - State **what's about to happen + the consequence**, then ask for consent.
24
+
25
+ ## P3 — Uncertainty / Low-confidence
26
+ - When unsure → **state the confidence level** + offer to verify, instead of asserting confidently.
27
+ - Cite sources/grounding when available. Distinguish "I know" vs "I'm inferring".
28
+
29
+ ## P4 — Error & Graceful Degradation
30
+ - On error → explain **in the user's language** (don't swallow the error, don't dump a stack trace).
31
+ - Prefer **a partial result + naming what's missing** over a blank failure.
32
+ - Suggest the next step / how to retry.
33
+
34
+ ## P5 — Refusal (safe refusal)
35
+ - Structure: **a concise refusal + reason + (if any) a valid alternative**.
36
+ - Keep a respectful, non-judgmental tone; don't reveal internal filtering details.
37
+ - Distinguish "not allowed" vs "can't do it" vs "needs more info".
38
+
39
+ ## P6 — Handoff to Human
40
+ - When to escalate: out of scope, high risk, the user requests it, or repeated failure.
41
+ - Hand off with a **context summary** so the receiving human doesn't have to ask from scratch.
42
+
43
+ ## P7 — Conversation Repair
44
+ - The user says "that's not it" → the assistant **briefly acknowledges, restates the new understanding, confirms**, then continues.
45
+ - Don't repeat the same wrong answer; don't get defensive.
46
+
47
+ ## P8 — Memory & Privacy
48
+ - Be clear about **what the assistant remembers / doesn't**; give the user a way to view/delete it.
49
+ - Don't expose sensitive data in responses/logs; follow the PRD §5 PII policy.
50
+
51
+ ## P9 — Tone & Consistency
52
+ - One consistent persona across features (locked in PRD §4).
53
+ - Concise by default; detailed when the user needs it.
54
+
55
+ ---
56
+
57
+ ## How to use
58
+ In an AI-feature PRD: §3 (ambiguity) points to **P1**; §5 (safety) points to **P5/P8**; §8 (fallback) points to **P4/P6/P7**; §4 (tone) points to **P9**. Each pattern gets the specific threshold/details for that feature.
@@ -0,0 +1,31 @@
1
+ # Performance Standards
2
+
3
+ > A **measurable** performance budget for this project. Set the budget during `hero-planning` and verify it during `hero-reviewing`/`hero-unit-test`.
4
+ >
5
+ > Fill the `<TBD>`s per product requirements when locked in the first PRD/TDD.
6
+
7
+ ## 1. General budget (parameterized)
8
+ - **Latency**: API p95 ≤ `<TBD>` ms, p99 ≤ `<TBD>` ms.
9
+ - **Throughput**: ≥ `<TBD>` req/s at target load.
10
+ - **Size**: payload/response ≤ `<TBD>`; frontend bundle (if any) ≤ `<TBD>` KB.
11
+ - **Database**: no N+1; queries per request ≤ `<TBD>`; indexes for hot queries.
12
+ - **Memory/CPU**: no leaks; baseline ≤ `<TBD>`.
13
+
14
+ ## 2. AI-specific (required for AI features)
15
+ > Cross-reference `templates/PRD_AI_FEATURE.md §9`.
16
+ - **Prompt caching — REQUIRED**: leverage Claude's caching for static prompt parts (system, grounding docs) to cut cost & latency. This is the biggest lever.
17
+ - **Model selection by task**: use the lightest sufficient model (Haiku → Sonnet → Opus); don't default to the strongest model for everything.
18
+ - **Token/cost ceiling**: a per-request token & cost ceiling `<TBD>`; alert on breach.
19
+ - **Streaming**: stream long responses to reduce perceived latency.
20
+ - **Context discipline**: load only the needed context; avoid stuffing whole documents into every turn.
21
+ - **Batching**: batch large non-realtime workloads.
22
+
23
+ ## 3. Performance regression gate
24
+ - **`change/` + `refactor/` touching a hot path**: measure a **before & after bench**, don't regress more than `<TBD>`%.
25
+ - **Feature** (Full path): at least one load measurement/assessment for the critical flow before merge.
26
+ - **Observability**: track p95/p99, token/cost, error rate after going to prod (see PRD §10).
27
+
28
+ ## 4. Checklist by path (feeds the DoD)
29
+ - **Fast path**: no obvious performance regression; no new N+1.
30
+ - **Standard path**: + before/after bench for code touching a hot path; + (AI) prompt caching preserved/applied.
31
+ - **Full path**: + meets the §1 budget; + (AI feature) meets the §2 token/latency ceiling; + a load measurement exists for the main flow.