brainforge-ai 1.2.0 → 1.2.1

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 (53) hide show
  1. package/README.md +863 -703
  2. package/dist/cli.js +47 -2
  3. package/dist/cli.js.map +1 -1
  4. package/dist/commands/defensePack.d.ts +2 -0
  5. package/dist/commands/defensePack.d.ts.map +1 -0
  6. package/dist/commands/defensePack.js +269 -0
  7. package/dist/commands/defensePack.js.map +1 -0
  8. package/dist/commands/difficulty.d.ts +2 -0
  9. package/dist/commands/difficulty.d.ts.map +1 -0
  10. package/dist/commands/difficulty.js +177 -0
  11. package/dist/commands/difficulty.js.map +1 -0
  12. package/dist/commands/doctor.d.ts.map +1 -1
  13. package/dist/commands/doctor.js +53 -1
  14. package/dist/commands/doctor.js.map +1 -1
  15. package/dist/commands/help.d.ts.map +1 -1
  16. package/dist/commands/help.js +24 -1
  17. package/dist/commands/help.js.map +1 -1
  18. package/dist/commands/init.d.ts +6 -1
  19. package/dist/commands/init.d.ts.map +1 -1
  20. package/dist/commands/init.js +64 -2
  21. package/dist/commands/init.js.map +1 -1
  22. package/dist/commands/professorCheck.d.ts +2 -0
  23. package/dist/commands/professorCheck.d.ts.map +1 -0
  24. package/dist/commands/professorCheck.js +203 -0
  25. package/dist/commands/professorCheck.js.map +1 -0
  26. package/dist/commands/simplify.d.ts +2 -0
  27. package/dist/commands/simplify.d.ts.map +1 -0
  28. package/dist/commands/simplify.js +174 -0
  29. package/dist/commands/simplify.js.map +1 -0
  30. package/dist/commands/status.d.ts +2 -0
  31. package/dist/commands/status.d.ts.map +1 -0
  32. package/dist/commands/status.js +105 -0
  33. package/dist/commands/status.js.map +1 -0
  34. package/dist/commands/study.d.ts +2 -0
  35. package/dist/commands/study.d.ts.map +1 -0
  36. package/dist/commands/study.js +193 -0
  37. package/dist/commands/study.js.map +1 -0
  38. package/dist/commands/update.js +2 -2
  39. package/dist/commands/update.js.map +1 -1
  40. package/dist/core/dashboard.d.ts +41 -0
  41. package/dist/core/dashboard.d.ts.map +1 -1
  42. package/dist/core/dashboard.js +121 -0
  43. package/dist/core/dashboard.js.map +1 -1
  44. package/dist/core/dashboardTemplate.d.ts.map +1 -1
  45. package/dist/core/dashboardTemplate.js +748 -317
  46. package/dist/core/dashboardTemplate.js.map +1 -1
  47. package/dist/core/fileSystem.d.ts.map +1 -1
  48. package/dist/core/fileSystem.js +175 -0
  49. package/dist/core/fileSystem.js.map +1 -1
  50. package/dist/core/templates.d.ts.map +1 -1
  51. package/dist/core/templates.js +525 -191
  52. package/dist/core/templates.js.map +1 -1
  53. package/package.json +5 -1
@@ -12,6 +12,11 @@ function getAgentTemplates(config) {
12
12
  **Project:** ${config.projectName}
13
13
  **Stack:** ${config.stack.join(', ')}
14
14
 
15
+ ## Load First (saves tokens)
16
+
17
+ Read \`.brainforge/brain.md\` before anything else.
18
+ It covers project config, code level, features, and current phase in one compact file.
19
+
15
20
  ## Skills — Read BEFORE Starting
16
21
 
17
22
  > Read every skill listed here before doing any work. No exceptions.
@@ -63,6 +68,11 @@ Impact: [What files/folders this affects]
63
68
  **Role:** Technical research before implementation
64
69
  **Project:** ${config.projectName}
65
70
 
71
+ ## Load First (saves tokens)
72
+
73
+ Read \`.brainforge/brain.md\` before anything else.
74
+ It covers project config, code level, and current phase in one compact file.
75
+
66
76
  ## Skills — Read BEFORE Starting
67
77
 
68
78
  > Read every skill listed here before doing any work. No exceptions.
@@ -114,6 +124,11 @@ Skills consulted: [list of .claude/skills/ files read]
114
124
  **Role:** Phase planning and task breakdown
115
125
  **Project:** ${config.projectName}
116
126
 
127
+ ## Load First (saves tokens)
128
+
129
+ Read \`.brainforge/brain.md\` before anything else.
130
+ It covers project config, code level, and current phase in one compact file.
131
+
117
132
  ## Skills — Read BEFORE Starting
118
133
 
119
134
  > Read every skill listed here before doing any work. No exceptions.
@@ -168,6 +183,12 @@ Estimated complexity: low / medium / high
168
183
  **Project:** ${config.projectName}
169
184
  **Code Level:** ${config.codeLevel}
170
185
 
186
+ ## Load First (saves tokens)
187
+
188
+ Read \`.brainforge/brain.md\` before anything else.
189
+ It covers project config, code level, and current phase in one compact file.
190
+ Then read \`.brainforge/memory/coding-style.md\` before writing any code.
191
+
171
192
  ## Skills — Read BEFORE Starting
172
193
 
173
194
  > Read every skill listed here BEFORE writing a single line of code. Skills contain rules, patterns, and checklists you must follow.
@@ -271,6 +292,16 @@ ${config.codeLevel === 'academic-realistic'
271
292
  1. Check off completed tasks in phase file
272
293
  2. Update \`.brainforge/memory/architecture.md\` if structure changed
273
294
  3. Suggest: \`/checkpoint\` to commit progress
295
+
296
+ ## Learning Memory Rule
297
+
298
+ After every meaningful implementation session, update \`.brainforge/memory/learning-notes.md\`:
299
+
300
+ - Add concepts learned
301
+ - Add bugs fixed and lessons
302
+ - Add files the user should understand
303
+ - Add questions the user should be able to answer
304
+ - Add things to review before presentation
274
305
  `,
275
306
  'reviewer.md': `# Agent: Reviewer
276
307
 
@@ -278,6 +309,11 @@ ${config.codeLevel === 'academic-realistic'
278
309
  **Project:** ${config.projectName}
279
310
  **Code Level:** ${config.codeLevel}
280
311
 
312
+ ## Load First (saves tokens)
313
+
314
+ Read \`.brainforge/brain.md\` before anything else.
315
+ It covers project config, code level, and current phase in one compact file.
316
+
281
317
  ## Skills — Read BEFORE Starting
282
318
 
283
319
  > Read every skill listed here before doing any review. No exceptions.
@@ -339,6 +375,11 @@ Level check: pass | fail
339
375
  **Role:** Explain code to students, prepare for presentations
340
376
  **Project:** ${config.projectName}
341
377
 
378
+ ## Load First (saves tokens)
379
+
380
+ Read \`.brainforge/brain.md\` before anything else.
381
+ It covers project config, code level, and current phase in one compact file.
382
+
342
383
  ## Skills — Read BEFORE Starting
343
384
 
344
385
  > Read every skill listed here before doing any work. No exceptions.
@@ -384,6 +425,15 @@ Key files: [list]
384
425
  What you should be able to say: [oral explanation guide]
385
426
  Potential questions a professor might ask: [list]
386
427
  \`\`\`
428
+
429
+ ## Learning Memory Rule
430
+
431
+ After every study, explanation, or defense session, update \`.brainforge/memory/learning-notes.md\`:
432
+
433
+ - Add concepts explained
434
+ - Add professor questions generated
435
+ - Add files the user needs to understand
436
+ - Add things to review before presentation
387
437
  `,
388
438
  'git-agent.md': `# Agent: Git Agent
389
439
 
@@ -698,6 +748,14 @@ skills_consulted: [list]
698
748
  - Use Write tool only for REVIEW.md — never modify source files
699
749
  - Always cite line numbers
700
750
  - Never flag style preferences as warnings unless they create bug risk
751
+
752
+ ## Learning Memory Rule
753
+
754
+ After every code review, update \`.brainforge/memory/learning-notes.md\`:
755
+
756
+ - Add bugs found and what caused them
757
+ - Add files the user should understand before presentation
758
+ - Add questions a professor could ask based on the reviewed code
701
759
  `,
702
760
  'brainforge-codebase-mapper.md': `# Agent: BrainForge Codebase Mapper
703
761
 
@@ -1828,6 +1886,146 @@ Process session messages against 8 behavioral dimensions and return a structured
1828
1886
  - Rate only what session evidence supports
1829
1887
  - Confidence = LOW if fewer than 2 signal instances
1830
1888
  - Never fabricate ratings from assumptions about skill level
1889
+ `,
1890
+ 'brainforge-router.md': `# Agent: BrainForge Router
1891
+
1892
+ **Role:** Central routing agent — decides the best command, workflow, and agents for any user request.
1893
+ **Project:** ${config.projectName}
1894
+ **Stack:** ${config.stack.join(', ')}
1895
+
1896
+ ## Load First (saves tokens)
1897
+
1898
+ Read \`.brainforge/brain.md\` before anything else.
1899
+
1900
+ ## Mission
1901
+
1902
+ You are the Router agent. You read the user's intent and recommend the best next action — the right command, the right agent, and the right sequence of steps.
1903
+
1904
+ You reduce confusion by making the decision simple: one clear recommendation with a reason.
1905
+
1906
+ ## Routing Table
1907
+
1908
+ | User intent | Recommended command | Main agent | Secondary agents |
1909
+ |-------------|--------------------|-----------|--------------------|
1910
+ | New project idea | \`/start-project\` | researcher | planner, architect |
1911
+ | Create phases | \`/create-roadmap\` | brainforge-roadmapper | planner |
1912
+ | Start a phase | \`/initiate-phase N\` | planner | researcher, architect |
1913
+ | Code a phase | \`/execute-phase N\` | coder | verifier |
1914
+ | Review phase quality | \`/review-phase N\` | reviewer | brainforge-code-reviewer |
1915
+ | Debug an issue | \`/debug-issue\` | debugger | brainforge-code-fixer |
1916
+ | Understand code | \`/explain-my-code\` | teacher | reviewer |
1917
+ | Prepare oral defense | \`/defense-pack\` | teacher | brainforge-verifier |
1918
+ | Check code difficulty | \`/analyze-difficulty\` | reviewer | teacher |
1919
+ | Study a phase | \`/study-phase N\` | teacher | reviewer |
1920
+ | Simplify academic code | \`/humanize-code\` or \`/simplify-codebase\` | reviewer | teacher |
1921
+ | Update dashboard | \`/update-dashboard\` | dashboard-agent | brainforge-doc-writer |
1922
+ | Check AI code risk | \`/professor-check\` | teacher | reviewer |
1923
+ | Write tests | \`/write-tests\` | tester | coder |
1924
+ | Generate docs | \`/generate-docs\` | brainforge-doc-writer | reviewer |
1925
+
1926
+ ## Agent Families
1927
+
1928
+ | Family | Use when |
1929
+ |--------|---------|
1930
+ | Planning (planner, researcher, architect) | Before writing any code |
1931
+ | Building (coder, verifier) | During implementation |
1932
+ | Reviewing (reviewer, code-reviewer) | After implementation |
1933
+ | Studying (teacher, user-profiler) | To understand and explain |
1934
+ | Debugging (debugger, code-fixer) | When something breaks |
1935
+ | Documenting (doc-writer, dashboard-agent) | For reports and docs |
1936
+
1937
+ ## Decision Rules
1938
+
1939
+ 1. Choose the simplest possible command
1940
+ 2. Avoid launching more than 2 agents unless explicitly asked
1941
+ 3. Ask maximum 3 clarifying questions if the intent is ambiguous
1942
+ 4. If \`config.isAcademic === true\`: prioritize Study/Defense commands
1943
+ 5. If professional project: prioritize security, tests, review
1944
+ 6. Always explain WHY you chose this route in one sentence
1945
+ 7. Always say which file to read next
1946
+
1947
+ ## Usage
1948
+
1949
+ \`\`\`
1950
+ /router [describe what you want to do]
1951
+ \`\`\`
1952
+
1953
+ ### Examples
1954
+
1955
+ \`\`\`
1956
+ /router I need to prepare my project for professor presentation
1957
+ → Recommended: brainforge study → /study-phase 1 → /defense-pack → brainforge serve
1958
+
1959
+ /router something is broken in my auth module
1960
+ → Recommended: /debug-issue — reads known-bugs.md first, fixes systematically
1961
+
1962
+ /router I don't know what to do next
1963
+ → Recommended: Read .brainforge/brain.md → run /router again with context
1964
+ \`\`\`
1965
+ `,
1966
+ 'README.md': `# BrainForge Agents
1967
+
1968
+ This folder contains all AI agents available in **${config.projectName}**.
1969
+
1970
+ BrainForge has many specialized agents. Think of them in 6 simple families.
1971
+
1972
+ ## Agent Families
1973
+
1974
+ | Family | Main agent | Sub-agents | When to use |
1975
+ |--------|------------|------------|-------------|
1976
+ | Routing | brainforge-router | — | Decide what to do next |
1977
+ | Planning | planner | roadmapper, researcher, architect | Before coding |
1978
+ | Building | coder | executor, verifier | During implementation |
1979
+ | Reviewing | reviewer | code-reviewer, security-auditor, ui-auditor | After implementation |
1980
+ | Debugging | debugger | debug-session-manager, code-fixer | When something breaks |
1981
+ | Studying | teacher | professor-check, user-profiler | To understand and defend |
1982
+ | Documentation | doc-writer | doc-verifier, doc-synthesizer | To generate docs |
1983
+ | Dashboard | dashboard-agent | intel-updater | To update visual dashboard |
1984
+
1985
+ ## Simple Mental Model
1986
+
1987
+ You only need to think in 6 roles:
1988
+
1989
+ \`\`\`
1990
+ Router → Planner → Builder → Reviewer → Debugger → Teacher
1991
+ \`\`\`
1992
+
1993
+ - Not sure what to do? → **Router**
1994
+ - Starting a new phase? → **Planner** + **Researcher**
1995
+ - Writing code? → **Coder** + **Verifier**
1996
+ - After finishing? → **Reviewer**
1997
+ - Something broke? → **Debugger** + **Code Fixer**
1998
+ - Preparing presentation? → **Teacher** + **Professor Check**
1999
+
2000
+ ## All Agents
2001
+
2002
+ | Agent file | Family | Primary use |
2003
+ |-----------|--------|------------|
2004
+ | brainforge-router.md | Routing | Choose the next command |
2005
+ | architect.md | Planning | System design decisions |
2006
+ | researcher.md | Planning | Research before implementation |
2007
+ | planner.md | Planning | Phase planning and task breakdown |
2008
+ | coder.md | Building | Write code following the plan |
2009
+ | reviewer.md | Reviewing | Code quality review |
2010
+ | teacher.md | Studying | Explain and teach the project |
2011
+ | git-agent.md | Building | Git operations and checkpoints |
2012
+ | brainforge-roadmapper.md | Planning | Create project roadmap |
2013
+ | brainforge-code-reviewer.md | Reviewing | Deep code review |
2014
+ | brainforge-code-fixer.md | Debugging | Fix bugs and issues |
2015
+ | brainforge-debugger.md | Debugging | Systematic debugging |
2016
+ | brainforge-security-auditor.md | Reviewing | Security audit |
2017
+ | brainforge-ui-auditor.md | Reviewing | UI/UX review |
2018
+ | brainforge-verifier.md | Building | Verify phase completion |
2019
+ | brainforge-doc-writer.md | Documentation | Write project docs |
2020
+ | brainforge-codebase-mapper.md | Documentation | Map codebase structure |
2021
+ | brainforge-user-profiler.md | Studying | Profile user coding behavior |
2022
+
2023
+ ## Quick Access
2024
+
2025
+ - Start with: \`/router\` to find the right agent
2026
+ - For students: \`brainforge study\` → \`/study-phase 1\` → \`/defense-pack\`
2027
+ - For debugging: \`/debug-issue\` with the error message
2028
+ - For quality: \`/review-phase N\` after each phase
1831
2029
  `,
1832
2030
  'brainforge-verifier.md': `# Agent: BrainForge Verifier
1833
2031
 
@@ -1892,6 +2090,14 @@ phase: XX
1892
2090
  ## Gaps
1893
2091
  [BLOCKER/WARNING/INFO entries]
1894
2092
  \`\`\`
2093
+
2094
+ ## Learning Memory Rule
2095
+
2096
+ After every verification session, update \`.brainforge/memory/learning-notes.md\`:
2097
+
2098
+ - Add files verified and their purpose
2099
+ - Add gaps found and what they mean
2100
+ - Add questions the user should be able to answer about verified code
1895
2101
  `,
1896
2102
  };
1897
2103
  }
@@ -2133,6 +2339,14 @@ Each phase file must contain:
2133
2339
  - Review report in the phase file
2134
2340
  - Bugs added to \`.brainforge/memory/known-bugs.md\`
2135
2341
  - Decision to approve or request changes
2342
+
2343
+ ## Learning Memory Rule
2344
+
2345
+ After every meaningful review session, update \`.brainforge/memory/learning-notes.md\`:
2346
+
2347
+ - Add bugs found and what caused them
2348
+ - Add files the user should understand before presentation
2349
+ - Add questions a professor could ask based on this code
2136
2350
  `,
2137
2351
  'humanize-code.md': `# /humanize-code
2138
2352
 
@@ -2508,6 +2722,275 @@ brainforge update-dashboard
2508
2722
 
2509
2723
  - Updated \`.brainforge/dashboard/data.json\`
2510
2724
  - Message: "Dashboard updated. Open .brainforge/dashboard/index.html"
2725
+ `,
2726
+ 'router.md': `# /router
2727
+
2728
+ **Objective:** Choose the best next command, agent, or workflow based on the user's intent.
2729
+
2730
+ ## Usage
2731
+
2732
+ \`\`\`
2733
+ /router [describe what you want to do]
2734
+ \`\`\`
2735
+
2736
+ ## Steps
2737
+
2738
+ 1. Read the user's intent
2739
+ 2. Read \`.brainforge/brain.md\` for project context
2740
+ 3. Recommend the best command and workflow
2741
+ 4. Explain why in one sentence
2742
+ 5. Say which file to read next
2743
+
2744
+ ## Examples
2745
+
2746
+ \`\`\`
2747
+ /router I need to prepare my project for professor presentation
2748
+ → Recommended workflow:
2749
+ 1. brainforge study
2750
+ 2. /study-phase 1
2751
+ 3. /analyze-difficulty
2752
+ 4. brainforge defense-pack
2753
+ 5. /defense-pack
2754
+
2755
+ /router something is broken in my auth module
2756
+ → Recommended: /debug-issue
2757
+
2758
+ /router I finished phase 2 and want to make sure everything is good
2759
+ → Recommended: /review-phase 2 → /checkpoint
2760
+ \`\`\`
2761
+
2762
+ ## Rules
2763
+
2764
+ - Recommend at most 2 agents unless the task clearly requires more
2765
+ - Ask at most 3 questions if the intent is unclear
2766
+ - Always say WHY you chose this route
2767
+ - For academic projects: prioritize Study / Defense commands
2768
+ - For professional: prioritize security, tests, review
2769
+ `,
2770
+ 'study-phase.md': `# /study-phase
2771
+
2772
+ **Objective:** Generate study material for a specific project phase to help understand and explain it.
2773
+
2774
+ ## Usage
2775
+
2776
+ \`\`\`
2777
+ /study-phase [phase-number]
2778
+ \`\`\`
2779
+
2780
+ Example: \`/study-phase 1\`
2781
+
2782
+ ## Context to Read First
2783
+
2784
+ - \`.brainforge/brain.md\`
2785
+ - \`.brainforge/phases/phase-[N].md\`
2786
+ - \`.brainforge/memory/architecture.md\`
2787
+ - \`.brainforge/memory/coding-style.md\`
2788
+ - \`.brainforge/memory/learning-notes.md\`
2789
+
2790
+ ## Steps
2791
+
2792
+ 1. Read the phase file and all context files
2793
+ 2. Understand what was built in this phase
2794
+ 3. Generate all study sections below
2795
+ 4. Update the study files
2796
+
2797
+ ## Output
2798
+
2799
+ Generate and write to these files:
2800
+
2801
+ ### \`.brainforge/study/study-guide.md\` — add phase section:
2802
+
2803
+ \`\`\`md
2804
+ ## Phase [N]: [title]
2805
+
2806
+ ### Simple explanation
2807
+ [2-3 sentences anyone can understand]
2808
+
2809
+ ### What was built
2810
+ - Feature/file 1
2811
+ - Feature/file 2
2812
+
2813
+ ### How it works (step by step)
2814
+ 1. [Step]
2815
+ 2. [Step]
2816
+
2817
+ ### Files to understand
2818
+ | File | Purpose | Difficulty /10 | Why important |
2819
+ \`\`\`
2820
+
2821
+ ### \`.brainforge/study/concepts-to-review.md\` — add concepts:
2822
+
2823
+ \`\`\`md
2824
+ | [concept] | [why it matters for this phase] | [related files] | high/medium/low |
2825
+ \`\`\`
2826
+
2827
+ ### \`.brainforge/study/professor-questions.md\` — add questions:
2828
+
2829
+ \`\`\`md
2830
+ | [realistic professor question] | [simple, honest answer] | [related file] |
2831
+ \`\`\`
2832
+
2833
+ ### \`.brainforge/study/oral-defense.md\` — add phase explanation:
2834
+
2835
+ \`\`\`md
2836
+ ## Phase [N] — Oral explanation
2837
+ [A paragraph the student can say during presentation]
2838
+ \`\`\`
2839
+
2840
+ ### \`.brainforge/memory/learning-notes.md\` — add lessons:
2841
+
2842
+ \`\`\`md
2843
+ | [date] | [concept from this phase] | [simple explanation] | [related files] |
2844
+ \`\`\`
2845
+
2846
+ ## Rules
2847
+
2848
+ - Use simple language — avoid jargon
2849
+ - Professor questions must be realistic (things professors actually ask)
2850
+ - Oral explanation must sound natural, not robotic
2851
+ - Difficulty scores must be honest (hard things should score high)
2852
+ `,
2853
+ 'analyze-difficulty.md': `# /analyze-difficulty
2854
+
2855
+ **Objective:** Scan every source file, score its complexity, and produce a difficulty report for oral defense preparation.
2856
+
2857
+ ## Usage
2858
+
2859
+ \`\`\`
2860
+ /analyze-difficulty
2861
+ \`\`\`
2862
+
2863
+ ## Context to Read First
2864
+
2865
+ - \`.brainforge/brain.md\`
2866
+ - \`.brainforge/memory/coding-style.md\`
2867
+ - \`.brainforge/memory/architecture.md\`
2868
+
2869
+ ## Steps
2870
+
2871
+ 1. Scan all source files (exclude node_modules, dist, .git, .brainforge)
2872
+ 2. Score each file 1–10 using the difficulty criteria
2873
+ 3. Identify files that would be hard to explain in an oral defense
2874
+ 4. Generate a recommended study plan
2875
+ 5. Write results to all output files
2876
+
2877
+ ## Difficulty Scoring Criteria
2878
+
2879
+ | Factor | Weight |
2880
+ |--------|--------|
2881
+ | Multiple responsibilities in one file | +1–2 |
2882
+ | Async / database / API logic | +1 |
2883
+ | Authentication / session / security | +1–2 |
2884
+ | Advanced TypeScript (generics, utility types) | +1–2 |
2885
+ | Complex state management | +1 |
2886
+ | Hidden side effects | +1 |
2887
+ | External service integration | +1 |
2888
+ | Large file (>200 lines) | +1 |
2889
+ | Architecture patterns (middleware, DI, etc.) | +1–2 |
2890
+
2891
+ ## Output
2892
+
2893
+ Write to \`.brainforge/reports/difficulty-report.md\`:
2894
+ - Overall project difficulty score
2895
+ - Risk level for oral defense
2896
+ - File difficulty map with scores
2897
+ - Top 3 files to study first
2898
+ - Patterns that are too advanced
2899
+ - Concepts to review
2900
+ - Recommended study plan
2901
+
2902
+ Also update:
2903
+ - \`.brainforge/study/file-map.md\` — all files with difficulty and must-understand flag
2904
+ - \`.brainforge/study/concepts-to-review.md\` — key concepts per file
2905
+ - \`.brainforge/memory/learning-notes.md\` — files to understand section
2906
+
2907
+ ## Rules
2908
+
2909
+ - Be honest — if something is hard, say so
2910
+ - Focus on what the student needs to explain, not just what works
2911
+ - Suggest simpler alternatives for overly complex patterns
2912
+ `,
2913
+ 'defense-pack.md': `# /defense-pack
2914
+
2915
+ **Objective:** Generate a complete oral defense and presentation preparation document.
2916
+
2917
+ ## Usage
2918
+
2919
+ \`\`\`
2920
+ /defense-pack
2921
+ \`\`\`
2922
+
2923
+ ## Context to Read First
2924
+
2925
+ Read these files (skip gracefully if they don't exist):
2926
+
2927
+ - \`.brainforge/brain.md\`
2928
+ - \`.brainforge/project.md\`
2929
+ - \`.brainforge/roadmap.md\`
2930
+ - \`.brainforge/phases/\` (all phase files)
2931
+ - \`.brainforge/memory/architecture.md\`
2932
+ - \`.brainforge/memory/learning-notes.md\`
2933
+ - \`.brainforge/reports/difficulty-report.md\`
2934
+ - \`.brainforge/reports/professor-check.md\`
2935
+
2936
+ ## Steps
2937
+
2938
+ 1. Read all available context files
2939
+ 2. Build a complete picture of the project
2940
+ 3. Generate all defense sections
2941
+ 4. Write to \`.brainforge/reports/defense-pack.md\`
2942
+ 5. Update \`.brainforge/study/oral-defense.md\`
2943
+
2944
+ ## Output Format
2945
+
2946
+ Write to \`.brainforge/reports/defense-pack.md\`:
2947
+
2948
+ \`\`\`md
2949
+ # Defense Pack
2950
+
2951
+ ## Project summary
2952
+ ### 30-second explanation
2953
+ ### 1-minute explanation
2954
+ ### 5-minute explanation
2955
+
2956
+ ## Problem and solution
2957
+
2958
+ ## Main features
2959
+
2960
+ ## Architecture explained simply
2961
+
2962
+ ## Folder structure explained
2963
+
2964
+ ## What each important file does
2965
+ | File | Role | How to explain it |
2966
+
2967
+ ## Difficult parts to revise
2968
+ | Topic | Why difficult | How to explain simply |
2969
+
2970
+ ## Professor questions and answers
2971
+ | Question | Suggested answer |
2972
+
2973
+ ## Demo script
2974
+ Step 1: [Show...]
2975
+ Step 2: [Navigate to...]
2976
+
2977
+ ## What to say if asked "Did you use AI?"
2978
+ [Honest, ethical answer that does not encourage lying]
2979
+
2980
+ ## Final checklist before presentation
2981
+ - [ ] I can explain the project goal
2982
+ - [ ] I can explain the architecture
2983
+ - [ ] I can explain the important files
2984
+ - [ ] I can run the project
2985
+ - [ ] I can answer likely questions
2986
+ \`\`\`
2987
+
2988
+ ## Rules
2989
+
2990
+ - Use simple, natural language
2991
+ - Professor questions must be realistic
2992
+ - The "Did you use AI?" answer must be honest and ethical — do not encourage lying
2993
+ - Demo script must be runnable step by step
2511
2994
  `,
2512
2995
  'write-tests.md': `# /write-tests
2513
2996
 
@@ -8023,12 +8506,17 @@ This project uses BrainForge — a structured, phase-based AI development system
8023
8506
  Idea → /start-project → /create-roadmap → /initiate-phase → /execute-phase → /review-phase → /checkpoint → /update-dashboard
8024
8507
  \`\`\`
8025
8508
 
8026
- ### Before Any Action
8509
+ ### Session Start (token-efficient)
8510
+
8511
+ **Load only one file to get full context:**
8512
+
8513
+ \`\`\`
8514
+ .brainforge/brain.md
8515
+ \`\`\`
8027
8516
 
8028
- 1. Read \`.brainforge/config.json\`
8029
- 2. Read \`.brainforge/project.md\`
8030
- 3. Read \`.brainforge/memory/coding-style.md\`
8031
- 4. Check the current phase in \`.brainforge/phases/\`
8517
+ brain.md contains project config, code rules, and phase status in a single compact file.
8518
+ Then load the active phase file only when you are executing that phase.
8519
+ Do NOT load config.json, project.md, and coding-style.md separately — brain.md covers them all.
8032
8520
 
8033
8521
  ### Code Rules
8034
8522
 
@@ -8048,102 +8536,6 @@ Idea → /start-project → /create-roadmap → /initiate-phase → /execute-pha
8048
8536
  ### Slash Commands Available
8049
8537
 
8050
8538
  See \`.brainforge/commands/\` for all available commands.
8051
-
8052
- ## Skills — ALWAYS USE THE APPROPRIATE SKILL
8053
-
8054
- Skills are installed in \`.claude/skills/\` (Claude Code) or \`.brainforge/agents/\` (all tools). **Before starting any task, read the matching skill file. It contains rules, checklists, and patterns you must follow.**
8055
-
8056
- | Task type | Skill |
8057
- |-----------|-------|
8058
- | System design, architecture, folder structure | \`software-architecture\` |
8059
- | Writing or fixing tests | \`test-driven-development\` |
8060
- | Reviewing code, audit, quality check | \`code-review\` |
8061
- | Any git operation | \`git-workflow\` |
8062
- | Debugging, tracing errors | \`ag-systematic-debugging\` |
8063
- | Generating changelogs or release notes | \`changelog\` |
8064
- | Writing docs, README, inline comments | \`documentation\` |
8065
- | Crafting AI prompts, optimizing interactions | \`prompt-engineering\` |
8066
- | Parallel / multi-agent task decomposition | \`subagent-development\` |
8067
- | Third-party API or SaaS integration | \`connect\` |
8068
- | Database queries, migrations, ORM | \`database-queries\` |
8069
- | Auth, security audit, access control | \`security-review\` |
8070
- | Browser/UI testing, Playwright | \`webapp-testing\` |
8071
- | React components, hooks, state | \`react-best-practices\` |
8072
- | Next.js routing, caching, SSR | \`next-best-practices\` |
8073
- | Core Web Vitals, bundle size | \`web-performance\` |
8074
- | ESLint, Semgrep, CodeQL, CVE scan | \`static-analysis\` |
8075
- | GitHub PRs, code review, CI | \`github-workflow\` |
8076
- | PostgreSQL schema, indexes, RLS | \`postgres-best-practices\` |
8077
- | Cloudflare Workers, KV, Wrangler | \`cloudflare-workers\` |
8078
- | Stripe payments, subscriptions | \`stripe-integration\` |
8079
- | Figma design handoff, CSS mapping | \`figma-to-code\` |
8080
- | Meta tags, schema markup, SEO | \`seo-optimization\` |
8081
- | React Native, Expo, mobile | \`react-native-best-practices\` |
8082
- | Terraform, IaC, cloud provisioning | \`terraform-infrastructure\` |
8083
- | GraphQL schema, Apollo, DataLoader | \`graphql-api\` |
8084
- | Docker, compose, multi-stage builds | \`docker-devops\` |
8085
- | TypeScript types, generics, strict mode | \`typescript-patterns\` |
8086
- | Tailwind utilities, responsive, dark mode | \`tailwind-css\` |
8087
- | Tailwind v4 specifics | \`ag-tailwind-v4\` |
8088
- | REST API design, OpenAPI, status codes | \`api-design\` |
8089
- | REST/RPC patterns, versioning, contracts | \`ag-api-patterns\` |
8090
- | JWT, OAuth2, session flows | \`authentication-oauth\` |
8091
- | Redis caching, TTL, invalidation | \`caching-redis\` |
8092
- | WebSockets, SSE, real-time features | \`websockets-realtime\` |
8093
- | File uploads, S3, image processing | \`file-uploads\` |
8094
- | Transactional email, Resend, templates | \`email-service\` |
8095
- | Rate limiting, throttling, abuse prevention | \`rate-limiting\` |
8096
- | Structured logging, tracing, OpenTelemetry | \`logging-observability\` |
8097
- | .env management, secrets, config validation | \`environment-config\` |
8098
- | Turborepo, pnpm workspaces, monorepo | \`monorepo\` |
8099
- | OpenAI API, embeddings, tool use | \`openai-integration\` |
8100
- | Supabase auth, DB, storage, realtime | \`supabase\` |
8101
- | Vercel deployment, edge middleware | \`vercel-deployment\` |
8102
- | Netlify functions, forms, deployment | \`netlify-deployment\` |
8103
- | Sanity CMS, GROQ queries, schema | \`sanity-cms\` |
8104
- | Web scraping, Firecrawl, Playwright extract | \`web-scraping\` |
8105
- | Better Auth setup, OAuth, 2FA | \`better-auth\` |
8106
- | WCAG, ARIA, keyboard nav, screen readers | \`accessibility\` |
8107
- | i18n, locale, date/currency formatting | \`internationalization\` |
8108
- | API integration tests, Supertest | \`api-testing\` |
8109
- | Pub/sub, message queues, BullMQ | \`event-driven-arch\` |
8110
- | Multi-step research with citations | \`deep-research\` |
8111
- | Technical writing, copywriting, README | \`content-writing\` |
8112
- | Svelte 5, SvelteKit routes and actions | \`svelte-sveltekit\` |
8113
- | Vue 3, Nuxt 3, Pinia, composables | \`vue-nuxt\` |
8114
- | Angular 17+, signals, standalone components | \`angular-development\` |
8115
- | Typed errors, Result type, retry logic | \`error-handling\` |
8116
- | Clean code, SOLID principles, refactoring | \`ag-clean-code\` |
8117
- | High-level architecture decisions, ADRs | \`ag-architecture\` |
8118
- | Full app scaffolding, feature planning | \`ag-app-builder\` |
8119
- | Bash scripting, Linux CLI, shell automation | \`ag-bash-linux\` |
8120
- | Idea generation, creative problem solving | \`ag-brainstorming\` |
8121
- | Code review checklists, PR standards | \`ag-code-review-checklist\` |
8122
- | Database schema design, normalization, ER | \`ag-database-design\` |
8123
- | Deployment procedures, rollbacks, runbooks | \`ag-deployment-procedures\` |
8124
- | Documentation templates, spec writing | \`ag-documentation-templates\` |
8125
- | Frontend design, component layout, UX | \`ag-frontend-design\` |
8126
- | Game development, game loops, physics | \`ag-game-development\` |
8127
- | GIS, coordinates, spatial queries, maps | \`ag-geo-fundamentals\` |
8128
- | Intelligent agent routing, task delegation | \`ag-intelligent-routing\` |
8129
- | Linting, formatting, validation pipelines | \`ag-lint-and-validate\` |
8130
- | MCP server/tool building, protocol | \`ag-mcp-builder\` |
8131
- | Mobile UI design, React Native, Expo | \`ag-mobile-design\` |
8132
- | Node.js best practices, streams, modules | \`ag-nodejs-best-practices\` |
8133
- | Parallel agents, task splitting, fan-out | \`ag-parallel-agents\` |
8134
- | Performance profiling, flame graphs, APM | \`ag-performance-profiling\` |
8135
- | Plan writing, scope docs, technical specs | \`ag-plan-writing\` |
8136
- | PowerShell scripting, Windows automation | \`ag-powershell-windows\` |
8137
- | Python patterns, packaging, type hints | \`ag-python-patterns\` |
8138
- | Threat modeling, red team tactics | \`ag-red-team-tactics\` |
8139
- | Rust ownership, lifetimes, async, traits | \`ag-rust-pro\` |
8140
- | Server management, nginx, systemd | \`ag-server-management\` |
8141
- | TDD workflow, test-first cycles | \`ag-tdd-workflow\` |
8142
- | Testing patterns, mocks, fixtures, coverage | \`ag-testing-patterns\` |
8143
- | Vulnerability scanning, OWASP, CVE | \`ag-vulnerability-scanner\` |
8144
- | Web design guidelines, visual hierarchy | \`ag-web-design-guidelines\` |
8145
-
8146
- **Rule:** Match your task to the table above and read that skill file before proceeding. Do not skip this step.
8147
8539
  `,
8148
8540
  'CLAUDE.md': `# Claude Code Instructions — BrainForge
8149
8541
 
@@ -8154,6 +8546,18 @@ Skills are installed in \`.claude/skills/\` (Claude Code) or \`.brainforge/agent
8154
8546
 
8155
8547
  This project is managed by BrainForge. Read \`AGENTS.md\` and the \`.brainforge/\` folder before doing anything.
8156
8548
 
8549
+ ## Session Start — Use brain.md to save tokens
8550
+
8551
+ **Always begin every session with one read:**
8552
+
8553
+ \`\`\`
8554
+ .brainforge/brain.md
8555
+ \`\`\`
8556
+
8557
+ brain.md is a compact summary of project config, code rules, and current phase.
8558
+ It replaces loading config.json + project.md + coding-style.md separately.
8559
+ Load other \`.brainforge/\` files only when the specific task requires them.
8560
+
8157
8561
  ## Slash Commands
8158
8562
 
8159
8563
  All slash commands are defined in \`.brainforge/commands/\`. Use them as your workflow guide.
@@ -8285,15 +8689,17 @@ Run \`brainforge update-dashboard\` after each phase or checkpoint.
8285
8689
 
8286
8690
  **Project:** ${config.projectName}
8287
8691
  **Stack:** ${stackStr}
8288
- **Code Level:** ${config.codeLevel}
8289
- **User Level:** ${config.userLevel}
8290
8692
 
8291
- ## Setup
8693
+ ## Session Start — Use brain.md to save tokens
8292
8694
 
8293
- This project uses BrainForge. Always start by reading:
8294
- - \`AGENTS.md\`
8295
- - \`.brainforge/project.md\`
8296
- - \`.brainforge/memory/coding-style.md\`
8695
+ **Load one file at the start of every session:**
8696
+
8697
+ \`\`\`
8698
+ .brainforge/brain.md
8699
+ \`\`\`
8700
+
8701
+ brain.md gives you project config, code rules, and current phase in one compact read.
8702
+ Do NOT load AGENTS.md + project.md + coding-style.md separately — brain.md covers them all.
8297
8703
 
8298
8704
  ## Workflow
8299
8705
 
@@ -8301,44 +8707,7 @@ Follow the BrainForge workflow defined in \`AGENTS.md\`.
8301
8707
 
8302
8708
  ## Code Level: ${config.codeLevel}
8303
8709
 
8304
- Do not write code above this level. Read \`.brainforge/memory/coding-style.md\` before writing any code.
8305
-
8306
- ## Skills — ALWAYS USE THE APPROPRIATE SKILL
8307
-
8308
- Skills are installed in \`.brainforge/agents/\` and \`.claude/skills/\`. **Before starting any task, read the matching skill file. It contains rules, checklists, and patterns you must follow.**
8309
-
8310
- | Task type | Skill |
8311
- |-----------|-------|
8312
- | System design, architecture, folder structure | \`software-architecture\` |
8313
- | Writing or fixing tests | \`test-driven-development\` |
8314
- | Reviewing code, audit, quality check | \`code-review\` |
8315
- | Any git operation | \`git-workflow\` |
8316
- | Debugging, tracing errors | \`ag-systematic-debugging\` |
8317
- | Writing docs, README, inline comments | \`documentation\` |
8318
- | Database queries, migrations, ORM | \`database-queries\` |
8319
- | Auth, security audit, access control | \`security-review\` |
8320
- | React components, hooks, state | \`react-best-practices\` |
8321
- | Next.js routing, caching, SSR | \`next-best-practices\` |
8322
- | TypeScript types, generics, strict mode | \`typescript-patterns\` |
8323
- | REST API design, OpenAPI, status codes | \`api-design\` |
8324
- | REST/RPC patterns, versioning, contracts | \`ag-api-patterns\` |
8325
- | Docker, compose, multi-stage builds | \`docker-devops\` |
8326
- | Tailwind utilities, responsive, dark mode | \`tailwind-css\` |
8327
- | JWT, OAuth2, session flows | \`authentication-oauth\` |
8328
- | Clean code, SOLID principles, refactoring | \`ag-clean-code\` |
8329
- | High-level architecture decisions, ADRs | \`ag-architecture\` |
8330
- | Frontend design, component layout, UX | \`ag-frontend-design\` |
8331
- | Node.js best practices, streams, modules | \`ag-nodejs-best-practices\` |
8332
- | Python patterns, packaging, type hints | \`ag-python-patterns\` |
8333
- | Testing patterns, mocks, fixtures, coverage | \`ag-testing-patterns\` |
8334
- | Vulnerability scanning, OWASP, CVE | \`ag-vulnerability-scanner\` |
8335
- | Plan writing, scope docs, technical specs | \`ag-plan-writing\` |
8336
- | Deployment procedures, rollbacks, runbooks | \`ag-deployment-procedures\` |
8337
- | Performance profiling, flame graphs, APM | \`ag-performance-profiling\` |
8338
- | Multi-step research with citations | \`deep-research\` |
8339
- | Technical writing, copywriting, README | \`content-writing\` |
8340
-
8341
- **Rule:** Match your task to the table above and read that skill before proceeding. For tasks not listed, check \`AGENTS.md\` for the full skills table.
8710
+ Do not write code above this level. Read \`.brainforge/memory/coding-style.md\` when coding.
8342
8711
 
8343
8712
  ## Git
8344
8713
 
@@ -8352,60 +8721,25 @@ See \`.brainforge/commands/\` for all slash commands.
8352
8721
 
8353
8722
  **Project:** ${config.projectName}
8354
8723
  **Stack:** ${stackStr}
8355
- **Code Level:** ${config.codeLevel}
8356
- **User Level:** ${config.userLevel}
8357
8724
 
8358
- ## Setup
8725
+ ## Session Start — Use brain.md to save tokens
8359
8726
 
8360
- Read before acting:
8361
- 1. \`AGENTS.md\`
8362
- 2. \`.brainforge/config.json\`
8363
- 3. \`.brainforge/memory/coding-style.md\`
8727
+ **Load one file at the start of every session:**
8364
8728
 
8365
- ## Workflow
8729
+ \`\`\`
8730
+ .brainforge/brain.md
8731
+ \`\`\`
8366
8732
 
8367
- Strictly follow the BrainForge phase workflow. No code without a plan.
8733
+ brain.md gives you project config, code rules, and current phase in one compact read.
8734
+ Do NOT load config.json + project.md + coding-style.md separately — brain.md covers them all.
8368
8735
 
8369
8736
  ## Code Level: ${config.codeLevel}
8370
8737
 
8371
- Target user level: ${config.userLevel}. Read \`.brainforge/memory/coding-style.md\` before writing any code.
8372
-
8373
- ## Skills — ALWAYS USE THE APPROPRIATE SKILL
8374
-
8375
- Skills are installed in \`.brainforge/agents/\` and \`.claude/skills/\`. **Before starting any task, read the matching skill file. It contains rules, checklists, and patterns you must follow.**
8738
+ Target user level: ${config.userLevel}
8376
8739
 
8377
- | Task type | Skill |
8378
- |-----------|-------|
8379
- | System design, architecture, folder structure | \`software-architecture\` |
8380
- | Writing or fixing tests | \`test-driven-development\` |
8381
- | Reviewing code, audit, quality check | \`code-review\` |
8382
- | Any git operation | \`git-workflow\` |
8383
- | Debugging, tracing errors | \`ag-systematic-debugging\` |
8384
- | Writing docs, README, inline comments | \`documentation\` |
8385
- | Database queries, migrations, ORM | \`database-queries\` |
8386
- | Auth, security audit, access control | \`security-review\` |
8387
- | React components, hooks, state | \`react-best-practices\` |
8388
- | Next.js routing, caching, SSR | \`next-best-practices\` |
8389
- | TypeScript types, generics, strict mode | \`typescript-patterns\` |
8390
- | REST API design, OpenAPI, status codes | \`api-design\` |
8391
- | REST/RPC patterns, versioning, contracts | \`ag-api-patterns\` |
8392
- | Docker, compose, multi-stage builds | \`docker-devops\` |
8393
- | Tailwind utilities, responsive, dark mode | \`tailwind-css\` |
8394
- | JWT, OAuth2, session flows | \`authentication-oauth\` |
8395
- | Clean code, SOLID principles, refactoring | \`ag-clean-code\` |
8396
- | High-level architecture decisions, ADRs | \`ag-architecture\` |
8397
- | Frontend design, component layout, UX | \`ag-frontend-design\` |
8398
- | Node.js best practices, streams, modules | \`ag-nodejs-best-practices\` |
8399
- | Python patterns, packaging, type hints | \`ag-python-patterns\` |
8400
- | Testing patterns, mocks, fixtures, coverage | \`ag-testing-patterns\` |
8401
- | Vulnerability scanning, OWASP, CVE | \`ag-vulnerability-scanner\` |
8402
- | Plan writing, scope docs, technical specs | \`ag-plan-writing\` |
8403
- | Deployment procedures, rollbacks, runbooks | \`ag-deployment-procedures\` |
8404
- | Performance profiling, flame graphs, APM | \`ag-performance-profiling\` |
8405
- | Multi-step research with citations | \`deep-research\` |
8406
- | Technical writing, copywriting, README | \`content-writing\` |
8740
+ ## Workflow
8407
8741
 
8408
- **Rule:** Match your task to the table above and read that skill before proceeding. For tasks not listed, check \`AGENTS.md\` for the full skills table.
8742
+ Strictly follow the BrainForge phase workflow. No code without a plan.
8409
8743
 
8410
8744
  ## Git Policy
8411
8745