rhachet-roles-bhrain 0.1.1 → 0.3.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 (159) hide show
  1. package/dist/.test/getContextOpenAI.js +1 -1
  2. package/dist/.test/getContextOpenAI.js.map +1 -1
  3. package/dist/domain.operations/review/compileReviewPrompt.d.ts +22 -0
  4. package/dist/domain.operations/review/compileReviewPrompt.js +95 -0
  5. package/dist/domain.operations/review/compileReviewPrompt.js.map +1 -0
  6. package/dist/domain.operations/review/enumFilesFromDiffs.d.ts +8 -0
  7. package/dist/domain.operations/review/enumFilesFromDiffs.js +74 -0
  8. package/dist/domain.operations/review/enumFilesFromDiffs.js.map +1 -0
  9. package/dist/domain.operations/review/enumFilesFromGlob.d.ts +8 -0
  10. package/dist/domain.operations/review/enumFilesFromGlob.js +31 -0
  11. package/dist/domain.operations/review/enumFilesFromGlob.js.map +1 -0
  12. package/dist/domain.operations/review/estimateTokenCount.d.ts +9 -0
  13. package/dist/domain.operations/review/estimateTokenCount.js +20 -0
  14. package/dist/domain.operations/review/estimateTokenCount.js.map +1 -0
  15. package/dist/domain.operations/review/formatReviewOutput.d.ts +14 -0
  16. package/dist/domain.operations/review/formatReviewOutput.js +42 -0
  17. package/dist/domain.operations/review/formatReviewOutput.js.map +1 -0
  18. package/dist/domain.operations/review/genTokenBreakdownMarkdown.d.ts +19 -0
  19. package/dist/domain.operations/review/genTokenBreakdownMarkdown.js +110 -0
  20. package/dist/domain.operations/review/genTokenBreakdownMarkdown.js.map +1 -0
  21. package/dist/domain.operations/review/genTokenBreakdownReport.d.ts +24 -0
  22. package/dist/domain.operations/review/genTokenBreakdownReport.js +64 -0
  23. package/dist/domain.operations/review/genTokenBreakdownReport.js.map +1 -0
  24. package/dist/domain.operations/review/invokeClaudeCode.d.ts +22 -0
  25. package/dist/domain.operations/review/invokeClaudeCode.js +92 -0
  26. package/dist/domain.operations/review/invokeClaudeCode.js.map +1 -0
  27. package/dist/domain.operations/review/writeInputArtifacts.d.ts +27 -0
  28. package/dist/domain.operations/review/writeInputArtifacts.js +50 -0
  29. package/dist/domain.operations/review/writeInputArtifacts.js.map +1 -0
  30. package/dist/domain.operations/review/writeOutputArtifacts.d.ts +12 -0
  31. package/dist/domain.operations/review/writeOutputArtifacts.js +46 -0
  32. package/dist/domain.operations/review/writeOutputArtifacts.js.map +1 -0
  33. package/dist/roles/architect/briefs/brains.replic/arc000.sources.[catalog].md +178 -0
  34. package/dist/roles/architect/briefs/brains.replic/arc101.concept.llm.[article].md +25 -0
  35. package/dist/roles/architect/briefs/brains.replic/arc102.concept.repl.[article].md +33 -0
  36. package/dist/roles/architect/briefs/brains.replic/arc103.concept.replic-brain.[article].md +35 -0
  37. package/dist/roles/architect/briefs/brains.replic/arc104.concept.context-window.[article].md +40 -0
  38. package/dist/roles/architect/briefs/brains.replic/arc105.concept.system-prompt.[article].md +44 -0
  39. package/dist/roles/architect/briefs/brains.replic/arc106.concept.tool-definition.[article].md +59 -0
  40. package/dist/roles/architect/briefs/brains.replic/arc107.concept.tool-call.[article].md +54 -0
  41. package/dist/roles/architect/briefs/brains.replic/arc108.concept.tool-result.[article].md +58 -0
  42. package/dist/roles/architect/briefs/brains.replic/arc109.concept.agentic-loop.[article].md +62 -0
  43. package/dist/roles/architect/briefs/brains.replic/arc110.concept.reasoning-trace.[article].md +58 -0
  44. package/dist/roles/architect/briefs/brains.replic/arc111.concept.react-pattern.[article].md +65 -0
  45. package/dist/roles/architect/briefs/brains.replic/arc112.concept.reflexion-pattern.[article].md +68 -0
  46. package/dist/roles/architect/briefs/brains.replic/arc113.concept.tree-of-thoughts.[article].md +76 -0
  47. package/dist/roles/architect/briefs/brains.replic/arc114.concept.self-consistency.[article].md +73 -0
  48. package/dist/roles/architect/briefs/brains.replic/arc115.concept.lats-pattern.[article].md +78 -0
  49. package/dist/roles/architect/briefs/brains.replic/arc116.concept.context-compaction.[article].md +71 -0
  50. package/dist/roles/architect/briefs/brains.replic/arc117.concept.subagent.[article].md +71 -0
  51. package/dist/roles/architect/briefs/brains.replic/arc118.concept.extended-thinking.[article].md +69 -0
  52. package/dist/roles/architect/briefs/brains.replic/arc119.concept.mcp.[article].md +78 -0
  53. package/dist/roles/architect/briefs/brains.replic/arc120.concept.session.[article].md +67 -0
  54. package/dist/roles/architect/briefs/brains.replic/arc121.concept.message.[article].md +79 -0
  55. package/dist/roles/architect/briefs/brains.replic/arc122.concept.plan-and-solve.[article].md +80 -0
  56. package/dist/roles/architect/briefs/brains.replic/arc150.concepts.treestruct.[article].md +126 -0
  57. package/dist/roles/architect/briefs/brains.replic/arc201.blueprint.claude-code.[article].md +417 -0
  58. package/dist/roles/architect/briefs/brains.replic/arc201.blueprint.claude-code.zoomin.reason.[article].md +507 -0
  59. package/dist/roles/architect/briefs/brains.replic/arc202.blueprint.codex.[article].md +354 -0
  60. package/dist/roles/architect/briefs/brains.replic/arc300.blueprints.comparison.[catalog].md +284 -0
  61. package/dist/roles/getRoleRegistry.js +2 -1
  62. package/dist/roles/getRoleRegistry.js.map +1 -1
  63. package/dist/roles/getRoleRegistry.readme.js +6 -0
  64. package/dist/roles/getRoleRegistry.readme.js.map +1 -1
  65. package/dist/roles/reviewer/briefs/review.tactics.md +60 -0
  66. package/dist/roles/reviewer/getReviewerRole.d.ts +6 -0
  67. package/dist/roles/reviewer/getReviewerRole.js +80 -0
  68. package/dist/roles/reviewer/getReviewerRole.js.map +1 -0
  69. package/dist/roles/reviewer/skills/review/review.d.ts +57 -0
  70. package/dist/roles/reviewer/skills/review/review.js +445 -0
  71. package/dist/roles/reviewer/skills/review/review.js.map +1 -0
  72. package/dist/roles/reviewer/skills/review/review.sh +21 -0
  73. package/dist/roles/reviewer/skills/review/review.ts +575 -0
  74. package/dist/roles/thinker/briefs/term=brain.atomic_vs_replic.md +8 -0
  75. package/dist/roles/thinker/getThinkerRole.js +1 -1
  76. package/dist/roles/thinker/getThinkerRole.js.map +1 -1
  77. package/dist/roles/thinker/skills/brief.articulate/.demo/article.vision.v2025_08_19..i1.via_chatgpt.md +47 -0
  78. package/dist/roles/thinker/skills/brief.articulate/.demo/article.vision.v2025_08_19.i2.via_rhachet.md +60 -0
  79. package/dist/roles/thinker/skills/brief.articulate/.demo/diverge.v2025_08_17.i1.md +62 -0
  80. package/dist/roles/thinker/skills/brief.articulate/.demo/diverge.v2025_08_17.i1.with_feedback.md +89 -0
  81. package/dist/roles/thinker/skills/brief.articulate/.demo/diverge.v2025_08_17.i2.md +47 -0
  82. package/dist/roles/thinker/skills/brief.articulate/.demo/joke.v2025_08_15.i1.md +44 -0
  83. package/dist/roles/thinker/skills/brief.articulate/.demo/joke.v2025_08_15.i2.md +63 -0
  84. package/dist/roles/thinker/skills/brief.articulate/.demo/joke.v2025_08_15.i3.md +51 -0
  85. package/dist/roles/thinker/skills/brief.articulate/.demo/user-journey.v2025_08_17.i1.md +62 -0
  86. package/dist/roles/thinker/skills/brief.articulate/.demo/user-journey.v2025_08_17.i2.md +49 -0
  87. package/dist/roles/thinker/skills/brief.articulate/.readme.md +0 -0
  88. package/dist/roles/thinker/skills/brief.articulate/stepArticulate.skill.js +1 -1
  89. package/dist/roles/thinker/skills/brief.articulate/stepArticulate.skill.js.map +1 -1
  90. package/dist/roles/thinker/skills/brief.articulate/stepArticulate.skill.ts +168 -0
  91. package/dist/roles/thinker/skills/brief.articulate/stepArticulate.ts +157 -0
  92. package/dist/roles/thinker/skills/brief.catalogize/.demo/joke.types.v2025_08_28.i1.md +93 -0
  93. package/dist/roles/thinker/skills/brief.catalogize/.demo/joke.types.v2025_08_28.i2.md +84 -0
  94. package/dist/roles/thinker/skills/brief.catalogize/.demo/joke.types.v2025_09_28.i1.no_focus_context.md +8 -0
  95. package/dist/roles/thinker/skills/brief.catalogize/.demo/joke.types.v2025_09_28.i2.md +54 -0
  96. package/dist/roles/thinker/skills/brief.catalogize/.demo/persona.usecases.v2025_08_28.i1.md +62 -0
  97. package/dist/roles/thinker/skills/brief.catalogize/.demo/persona.usecases.v2025_08_28.i2.md +64 -0
  98. package/dist/roles/thinker/skills/brief.catalogize/.readme.md +5 -0
  99. package/dist/roles/thinker/skills/brief.catalogize/stepCatalogize.skill.js +1 -1
  100. package/dist/roles/thinker/skills/brief.catalogize/stepCatalogize.skill.js.map +1 -1
  101. package/dist/roles/thinker/skills/brief.catalogize/stepCatalogize.skill.ts +173 -0
  102. package/dist/roles/thinker/skills/brief.catalogize/stepCatalogize.ts +132 -0
  103. package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.input.example.i4.md +3 -0
  104. package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.input.example.i5.md +3 -0
  105. package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.input.example.i6.md +3 -0
  106. package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.input.example.md +3 -0
  107. package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i1.md +52 -0
  108. package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i2.md +51 -0
  109. package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i3.md +47 -0
  110. package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i4.md +62 -0
  111. package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i5.md +47 -0
  112. package/dist/roles/thinker/skills/brief.demonstrate/.demo/user.journey.roadtrip.v2025_08_27.i6.md +53 -0
  113. package/dist/roles/thinker/skills/brief.demonstrate/.readme +3 -0
  114. package/dist/roles/thinker/skills/brief.demonstrate/stepDemonstrate.skill.js +1 -1
  115. package/dist/roles/thinker/skills/brief.demonstrate/stepDemonstrate.skill.js.map +1 -1
  116. package/dist/roles/thinker/skills/brief.demonstrate/stepDemonstrate.skill.ts +190 -0
  117. package/dist/roles/thinker/skills/brief.demonstrate/stepDemonstrate.ts +164 -0
  118. package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input1.cluster.v2025_08_17.i1.md +72 -0
  119. package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input1.cluster.v2025_08_17.i2.md +53 -0
  120. package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input1.cluster.v2025_08_17.i3.which_objectives.md +58 -0
  121. package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input1.cluster.v2025_08_17.i5.which_personas.md +64 -0
  122. package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input2.cluster.v2025_08_17.i1.md +67 -0
  123. package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input2.cluster.v2025_08_17.i2.md +49 -0
  124. package/dist/roles/thinker/skills/khue.cluster/.demo/user.journeys.input2.cluster.v2025_08_17.i3.md +59 -0
  125. package/dist/roles/thinker/skills/khue.cluster/.readme.md +0 -0
  126. package/dist/roles/thinker/skills/khue.cluster/stepCluster.skill.js +1 -1
  127. package/dist/roles/thinker/skills/khue.cluster/stepCluster.skill.js.map +1 -1
  128. package/dist/roles/thinker/skills/khue.cluster/stepCluster.skill.ts +174 -0
  129. package/dist/roles/thinker/skills/khue.cluster/stepCluster.ts +150 -0
  130. package/dist/roles/thinker/skills/khue.decompose/.readme.md +9 -0
  131. package/dist/roles/thinker/skills/khue.diverge/.demo/joke.examples.v2025_08_17.i2.md +23 -0
  132. package/dist/roles/thinker/skills/khue.diverge/.demo/joke.examples.v2025_08_17.i3.md +23 -0
  133. package/dist/roles/thinker/skills/khue.diverge/.demo/joke.varieties.v2025_08_17.i1.md +23 -0
  134. package/dist/roles/thinker/skills/khue.diverge/.demo/userjourney.examples.v2025_08_17.i1.md +9 -0
  135. package/dist/roles/thinker/skills/khue.diverge/.demo/userjourney.examples.v2025_08_17.i2.md +9 -0
  136. package/dist/roles/thinker/skills/khue.diverge/.demo/userjourney.examples.v2025_08_17.i3.md +23 -0
  137. package/dist/roles/thinker/skills/khue.diverge/.demo/userjourney.examples.v2025_08_17.i4.folksy.md +9 -0
  138. package/dist/roles/thinker/skills/khue.diverge/.demo/userjourney.examples.v2025_08_17.i5.folksy.md +23 -0
  139. package/dist/roles/thinker/skills/khue.diverge/.readme.md +0 -0
  140. package/dist/roles/thinker/skills/khue.diverge/stepDiverge.skill.js +1 -1
  141. package/dist/roles/thinker/skills/khue.diverge/stepDiverge.skill.js.map +1 -1
  142. package/dist/roles/thinker/skills/khue.diverge/stepDiverge.skill.ts +149 -0
  143. package/dist/roles/thinker/skills/khue.diverge/stepDiverge.ts +151 -0
  144. package/dist/roles/thinker/skills/khue.encompose/.readme.md +7 -0
  145. package/dist/roles/thinker/skills/khue.instantiate/.readme.md +14 -0
  146. package/dist/roles/thinker/skills/khue.instantiate/stepInstantiate.skill.js +1 -1
  147. package/dist/roles/thinker/skills/khue.instantiate/stepInstantiate.skill.js.map +1 -1
  148. package/dist/roles/thinker/skills/khue.instantiate/stepInstantiate.skill.ts +190 -0
  149. package/dist/roles/thinker/skills/khue.instantiate/stepInstantiate.ts +132 -0
  150. package/dist/roles/thinker/skills/khue.triage/.demo/laughs.v2025_08_18.i1.md +29 -0
  151. package/dist/roles/thinker/skills/khue.triage/.demo/user.journeys.v2025_08_17.i1.md +86 -0
  152. package/dist/roles/thinker/skills/khue.triage/.demo/user.journeys.v2025_08_17.i2.md +68 -0
  153. package/dist/roles/thinker/skills/khue.triage/.readme.md +0 -0
  154. package/dist/roles/thinker/skills/khue.triage/stepTriage.skill.js +1 -1
  155. package/dist/roles/thinker/skills/khue.triage/stepTriage.skill.js.map +1 -1
  156. package/dist/roles/thinker/skills/khue.triage/stepTriage.skill.ts +174 -0
  157. package/dist/roles/thinker/skills/khue.triage/stepTriage.ts +153 -0
  158. package/package.json +9 -7
  159. package/readme.md +55 -0
@@ -0,0 +1,71 @@
1
+ # context-compaction
2
+
3
+ ## .what
4
+
5
+ techniques for reducing the token count of accumulated context while preserving essential information, enabling long-running agent sessions within fixed context window limits.
6
+
7
+ ## .why
8
+
9
+ as replic brains iterate through the agentic loop, context accumulates: tool results, conversation turns, reasoning traces. without compaction, the context window fills and the agent cannot continue. compaction strategies allow sessions to persist indefinitely while retaining relevant information.
10
+
11
+ ## dependsOn
12
+
13
+ - `context-window` — the constraint being managed
14
+ - `llm` — may perform summarization
15
+ - `agentic-loop` — produces context to compact
16
+
17
+ ## strategies
18
+
19
+ ### summarization
20
+ condense earlier conversation/results into summaries:
21
+ ```
22
+ [Original: 5000 tokens of tool results]
23
+ ↓ summarize
24
+ [Summary: 200 tokens capturing key findings]
25
+ ```
26
+
27
+ ### sliding window
28
+ keep only the most recent N turns:
29
+ ```
30
+ [turn 1] [turn 2] [turn 3] [turn 4] [turn 5]
31
+ ↓ window of 3
32
+ [turn 3] [turn 4] [turn 5]
33
+ ```
34
+
35
+ ### hierarchical memory (MemGPT)
36
+ tier information by recency/importance:
37
+ ```
38
+ L1 (context): current working set
39
+ L2 (recall): summarized past sessions
40
+ L3 (archive): compressed long-term storage
41
+ ```
42
+
43
+ ### selective retention
44
+ keep only tool results that inform current task:
45
+ ```
46
+ [file read A] [file read B] [file read C]
47
+ ↓ task now focuses on C
48
+ [file read C]
49
+ ```
50
+
51
+ ## tradeoffs
52
+
53
+ | strategy | preserves | loses |
54
+ |----------|-----------|-------|
55
+ | summarization | gist | verbatim details |
56
+ | sliding window | recency | early context |
57
+ | hierarchical | structure | fast access to old data |
58
+ | selective | relevance | potentially useful info |
59
+
60
+ ## implementation in replic brains
61
+
62
+ | system | compaction approach |
63
+ |--------|---------------------|
64
+ | claude code | auto-summarization when context fills |
65
+ | codex cloud | full context (large windows) |
66
+ | aider | git diff-based context |
67
+
68
+ ## sources
69
+
70
+ - [MemGPT: Towards LLMs as Operating Systems](https://arxiv.org/abs/2310.08560) — hierarchical memory
71
+ - [Building Effective Agents](https://www.anthropic.com/research/building-effective-agents) — summarization patterns
@@ -0,0 +1,71 @@
1
+ # subagent
2
+
3
+ ## .what
4
+
5
+ a child agent spawned by a parent agent, operating with its own isolated context window to perform a delegated subtask before returning results.
6
+
7
+ ## .why
8
+
9
+ subagents address two key challenges: context exhaustion and task parallelization. by delegating subtasks to agents with fresh context windows, the parent can tackle larger problems without filling its own context. subagents can also run in parallel for independent tasks.
10
+
11
+ ## dependsOn
12
+
13
+ - `agentic-loop` — both parent and child run loops
14
+ - `context-window` — isolation is the key benefit
15
+ - `tool-definition` — subagent spawning is a tool
16
+
17
+ ## pattern
18
+
19
+ ```
20
+ Parent Agent (main context)
21
+
22
+ ├── Task tool: "explore codebase for auth patterns"
23
+ │ │
24
+ │ └── Subagent (fresh context)
25
+ │ ├── Glob, Grep, Read...
26
+ │ └── Returns summary
27
+
28
+ └── Continues with summary in context
29
+ ```
30
+
31
+ ## key characteristics
32
+
33
+ - **isolated context**: subagent starts fresh
34
+ - **focused task**: single delegated objective
35
+ - **returns results**: output injected into parent context
36
+ - **may be typed**: different subagent types for different tasks
37
+
38
+ ## subagent types (claude code)
39
+
40
+ | type | purpose | tools available |
41
+ |------|---------|-----------------|
42
+ | Explore | codebase exploration | Glob, Grep, Read |
43
+ | Plan | implementation planning | Read, planning tools |
44
+ | general-purpose | complex multi-step tasks | all tools |
45
+
46
+ ## parallelization
47
+
48
+ subagents enable parallel execution:
49
+ ```
50
+ Parent: "search for auth and search for database patterns"
51
+
52
+ ├── Subagent A: auth exploration ──────┐
53
+ │ ├── (parallel)
54
+ └── Subagent B: database exploration ──┘
55
+
56
+ └── Combine results
57
+ ```
58
+
59
+ ## tradeoffs
60
+
61
+ | benefit | cost |
62
+ |---------|------|
63
+ | context isolation | summarization loss when returning |
64
+ | parallelization | coordination complexity |
65
+ | fresh start | loses parent context unless passed |
66
+ | focused execution | additional API calls |
67
+
68
+ ## sources
69
+
70
+ - [Building Agents with Claude Agent SDK](https://www.anthropic.com/engineering/building-agents-with-the-claude-agent-sdk) — subagent patterns
71
+ - [Claude Code Documentation](https://docs.anthropic.com) — Task tool specification
@@ -0,0 +1,69 @@
1
+ # extended-thinking
2
+
3
+ ## .what
4
+
5
+ a capability that allows an llm to allocate additional computation (serial test-time compute) to reasoning before producing a final response, controlled by a token budget.
6
+
7
+ ## .why
8
+
9
+ extended thinking enables "thinking harder" about complex problems. by giving the model a dedicated budget for internal reasoning, it can explore approaches, verify its work, and catch errors before committing to an answer. this is particularly valuable for coding, math, and analysis tasks.
10
+
11
+ ## dependsOn
12
+
13
+ - `llm` — must support thinking mode
14
+ - `reasoning-trace` — thinking produces traces
15
+ - `context-window` — thinking consumes budget tokens
16
+
17
+ ## mechanism
18
+
19
+ ```
20
+ [User Query]
21
+
22
+
23
+ [Extended Thinking: up to N tokens]
24
+ - "Let me consider the approaches..."
25
+ - "First approach: ..."
26
+ - "Wait, that won't work because..."
27
+ - "Better approach: ..."
28
+
29
+
30
+ [Final Response: informed by thinking]
31
+ ```
32
+
33
+ ## key characteristics
34
+
35
+ - **token budget**: user specifies max thinking tokens (1k-128k)
36
+ - **hybrid mode**: can be toggled on/off per request
37
+ - **serial compute**: sequential reasoning steps
38
+ - **varying visibility**: thinking may be hidden or shown
39
+
40
+ ## budget guidelines
41
+
42
+ | budget | suitable for |
43
+ |--------|--------------|
44
+ | 1k-4k | simple analysis |
45
+ | 4k-16k | moderate complexity |
46
+ | 16k-64k | complex coding/math |
47
+ | 64k-128k | deep research |
48
+
49
+ ## integration with tools
50
+
51
+ extended thinking can be combined with tool use:
52
+ - think before deciding which tools to use
53
+ - think after receiving tool results
54
+ - "think" tool forces explicit reasoning pause
55
+
56
+ ## vs other patterns
57
+
58
+ | pattern | mechanism |
59
+ |---------|-----------|
60
+ | CoT | inline reasoning in response |
61
+ | ToT | explore multiple branches |
62
+ | Extended thinking | dedicated compute budget |
63
+ | Self-consistency | multiple samples, voting |
64
+
65
+ ## sources
66
+
67
+ - [Claude's Extended Thinking](https://www.anthropic.com/news/visible-extended-thinking) — announcement
68
+ - [Using Extended Thinking](https://support.claude.com/en/articles/10574485-using-extended-thinking) — documentation
69
+ - [The "think" Tool](https://www.anthropic.com/engineering/claude-think-tool) — tool integration
@@ -0,0 +1,78 @@
1
+ # mcp (model context protocol)
2
+
3
+ ## .what
4
+
5
+ an open protocol that standardizes how llm applications connect to external tools, data sources, and services through a unified interface.
6
+
7
+ ## .why
8
+
9
+ mcp solves the N×M integration problem: without a standard, every llm application must build custom integrations for every tool. with mcp, tool providers implement the protocol once, and any mcp-compatible application can use it. this enables a rich ecosystem of interoperable tools.
10
+
11
+ ## dependsOn
12
+
13
+ - `tool-definition` — mcp defines tool schemas
14
+ - `tool-call` — mcp routes tool invocations
15
+ - `tool-result` — mcp returns structured results
16
+
17
+ ## architecture
18
+
19
+ ```
20
+ ┌─────────────────┐ ┌──────────────────┐
21
+ │ LLM Application │ │ MCP Server │
22
+ │ (Claude Code) │────▶│ (filesystem) │
23
+ └─────────────────┘ └──────────────────┘
24
+ │ │
25
+ │ MCP Protocol │
26
+ │◀─────────────────────▶│
27
+ │ │
28
+ ▼ ▼
29
+ ┌─────────────────┐ ┌──────────────────┐
30
+ │ MCP Server │ │ MCP Server │
31
+ │ (database) │ │ (github) │
32
+ └─────────────────┘ └──────────────────┘
33
+ ```
34
+
35
+ ## protocol components
36
+
37
+ | component | purpose |
38
+ |-----------|---------|
39
+ | tools | actions the server exposes |
40
+ | resources | data the server provides |
41
+ | prompts | templates for common operations |
42
+ | transports | communication channels (stdio, http) |
43
+
44
+ ## tool definition in mcp
45
+
46
+ ```json
47
+ {
48
+ "name": "read_file",
49
+ "description": "Read contents of a file",
50
+ "inputSchema": {
51
+ "type": "object",
52
+ "properties": {
53
+ "path": { "type": "string" }
54
+ },
55
+ "required": ["path"]
56
+ }
57
+ }
58
+ ```
59
+
60
+ ## benefits
61
+
62
+ - **extensibility**: add new tools without changing core
63
+ - **standardization**: consistent interface across providers
64
+ - **composability**: combine multiple servers
65
+ - **permission control**: allowedTools/disallowedTools
66
+
67
+ ## adoption
68
+
69
+ | system | mcp support |
70
+ |--------|-------------|
71
+ | claude code | native, primary integration mechanism |
72
+ | cursor | supported |
73
+ | cline | supported |
74
+
75
+ ## sources
76
+
77
+ - [Model Context Protocol](https://modelcontextprotocol.io/) — specification
78
+ - [Building Agents with Claude Agent SDK](https://www.anthropic.com/engineering/building-agents-with-the-claude-agent-sdk) — MCP integration
@@ -0,0 +1,67 @@
1
+ # session
2
+
3
+ ## .what
4
+
5
+ a single continuous interaction instance between a user and a replic brain, encompassing the conversation history, tool invocations, and accumulated context from start to termination.
6
+
7
+ ## .why
8
+
9
+ the session is the unit of work for replic brains. it defines the scope of context retention, the boundary of memory, and the lifecycle of an agent's engagement with a task. understanding sessions is essential for designing effective agent workflows.
10
+
11
+ ## dependsOn
12
+
13
+ - `context-window` — session state lives in context
14
+ - `agentic-loop` — session contains loop iterations
15
+ - `message` — session contains messages
16
+
17
+ ## lifecycle
18
+
19
+ ```
20
+ ┌─────────────────────────────────────────┐
21
+ │ SESSION START │
22
+ ├─────────────────────────────────────────┤
23
+ │ [system prompt loaded] │
24
+ │ [user message 1] │
25
+ │ [assistant response 1 + tool calls] │
26
+ │ [tool results] │
27
+ │ [assistant response 2] │
28
+ │ [user message 2] │
29
+ │ ... │
30
+ ├─────────────────────────────────────────┤
31
+ │ SESSION END │
32
+ │ - user closes │
33
+ │ - context exhausted │
34
+ │ - timeout │
35
+ └─────────────────────────────────────────┘
36
+ ```
37
+
38
+ ## key characteristics
39
+
40
+ - **stateful**: accumulates context over time
41
+ - **bounded**: limited by context window
42
+ - **isolated**: separate from other sessions
43
+ - **resumable**: some systems support continuation
44
+
45
+ ## session persistence
46
+
47
+ | approach | mechanism |
48
+ |----------|-----------|
49
+ | ephemeral | context cleared on end |
50
+ | summarized | save summary for resumption |
51
+ | full history | persist all messages externally |
52
+ | project-based | context per project directory |
53
+
54
+ ## multi-session patterns
55
+
56
+ ```
57
+ Session 1: "Set up the database schema"
58
+
59
+ ↓ (summarized, ended)
60
+
61
+ Session 2: "Add authentication" (builds on summary)
62
+ ```
63
+
64
+ ## sources
65
+
66
+ - [Building Effective Agents](https://www.anthropic.com/research/building-effective-agents) — session design
67
+ - [MemGPT](https://arxiv.org/abs/2310.08560) — cross-session memory
@@ -0,0 +1,79 @@
1
+ # message
2
+
3
+ ## .what
4
+
5
+ the atomic unit of conversation in a replic brain session, carrying content from a specific role (user, assistant, system, tool) with associated metadata.
6
+
7
+ ## .why
8
+
9
+ messages are the building blocks of context. understanding message structure and roles is fundamental to designing effective prompts, managing context, and debugging agent behavior. each message type serves a distinct purpose in the conversation flow.
10
+
11
+ ## dependsOn
12
+
13
+ - `session` — messages exist within sessions
14
+ - `context-window` — messages consume tokens
15
+
16
+ ## message roles
17
+
18
+ | role | purpose | example |
19
+ |------|---------|---------|
20
+ | system | initial instructions | system prompt, tool definitions |
21
+ | user | human input | questions, commands, feedback |
22
+ | assistant | llm output | responses, tool calls, reasoning |
23
+ | tool | tool execution results | file contents, command output |
24
+
25
+ ## message structure
26
+
27
+ ```json
28
+ {
29
+ "role": "assistant",
30
+ "content": "Let me read that file for you.",
31
+ "tool_calls": [
32
+ {
33
+ "id": "call_abc123",
34
+ "type": "function",
35
+ "function": {
36
+ "name": "Read",
37
+ "arguments": "{\"file_path\": \"/src/main.ts\"}"
38
+ }
39
+ }
40
+ ]
41
+ }
42
+ ```
43
+
44
+ ## content types
45
+
46
+ | type | description |
47
+ |------|-------------|
48
+ | text | natural language content |
49
+ | tool_calls | structured action requests |
50
+ | tool_results | output from tool execution |
51
+ | images | visual input (multimodal) |
52
+ | thinking | extended reasoning (if visible) |
53
+
54
+ ## message flow in agentic loop
55
+
56
+ ```
57
+ [user message]
58
+
59
+
60
+ [assistant message + tool_calls]
61
+
62
+
63
+ [tool message (result)]
64
+
65
+
66
+ [assistant message (continues)]
67
+ ```
68
+
69
+ ## token accounting
70
+
71
+ each message consumes tokens based on:
72
+ - role tokens (small overhead)
73
+ - content tokens (varies widely)
74
+ - metadata (tool call structures)
75
+
76
+ ## sources
77
+
78
+ - [Anthropic API Documentation](https://docs.anthropic.com) — message format
79
+ - [OpenAI API Documentation](https://platform.openai.com/docs) — chat completions
@@ -0,0 +1,80 @@
1
+ # plan-and-solve
2
+
3
+ ## .what
4
+
5
+ a zero-shot prompting strategy that decomposes complex tasks into two phases: first devise a plan of subtasks, then execute each subtask sequentially.
6
+
7
+ ## .why
8
+
9
+ plan-and-solve addresses a limitation of direct chain-of-thought: models may rush into computation without strategic planning. by explicitly separating planning from execution, PS prompting improves accuracy on multi-step reasoning tasks without requiring few-shot examples.
10
+
11
+ ## dependsOn
12
+
13
+ - `reasoning-trace` — plan is a form of reasoning
14
+ - `llm` — generates plan and executes steps
15
+
16
+ ## pattern structure
17
+
18
+ ```
19
+ Prompt: "Let's first understand the problem and devise a plan
20
+ to solve it. Then, let's carry out the plan and solve
21
+ the problem step by step."
22
+
23
+ Response:
24
+ Plan:
25
+ 1. Identify the variables
26
+ 2. Set up the equation
27
+ 3. Solve for x
28
+ 4. Verify the answer
29
+
30
+ Execution:
31
+ Step 1: The variables are...
32
+ Step 2: The equation is...
33
+ Step 3: Solving: x = ...
34
+ Step 4: Verification: ...
35
+
36
+ Answer: x = 42
37
+ ```
38
+
39
+ ## key characteristics
40
+
41
+ - **zero-shot**: no examples needed
42
+ - **explicit planning**: forces strategic thinking
43
+ - **sequential execution**: follows plan order
44
+ - **self-contained**: plan and execution in one response
45
+
46
+ ## variants
47
+
48
+ | variant | modification |
49
+ |---------|--------------|
50
+ | PS | basic plan + solve |
51
+ | PS+ | adds "extract relevant variables" |
52
+ | ADaPT | adaptive as-needed decomposition |
53
+
54
+ ## benchmark performance
55
+
56
+ | benchmark | improvement over zero-shot CoT |
57
+ |-----------|-------------------------------|
58
+ | GSM8K | +6.6% (GPT-3) |
59
+ | AQuA | +6.0% |
60
+ | MultiArith | +4.0% |
61
+
62
+ ## vs few-shot CoT
63
+
64
+ | aspect | PS | few-shot CoT |
65
+ |--------|-----|--------------|
66
+ | examples needed | 0 | 3-8 |
67
+ | planning | explicit | implicit |
68
+ | adaptability | high | fixed pattern |
69
+
70
+ ## application in replic brains
71
+
72
+ many replic brains implement plan-and-solve implicitly:
73
+ - "Plan" subagent type
74
+ - EnterPlanMode tool
75
+ - explicit planning before coding
76
+
77
+ ## sources
78
+
79
+ - [Plan-and-Solve Prompting](https://arxiv.org/abs/2305.04091) — original paper
80
+ - [Understanding LLM Agent Planning Survey](https://arxiv.org/abs/2402.02716) — positions in taxonomy
@@ -0,0 +1,126 @@
1
+ # concepts treestruct
2
+
3
+ ## .what
4
+
5
+ a hierarchical visualization of replic brain concepts showing dependency relationships — foundational concepts at roots, composed concepts as branches.
6
+
7
+ ## .why
8
+
9
+ understanding how concepts compose reveals the architecture of replic brains. this treestruct shows which concepts are foundational (independent), which depend on others, and how they combine to form complete agent systems.
10
+
11
+ ---
12
+
13
+ ## dependency treestruct
14
+
15
+ ```
16
+ replic-brain
17
+ ├── llm ································· [arc101]
18
+ │ ├── context-window ················· [arc104]
19
+ │ │ ├── context-compaction ········· [arc116]
20
+ │ │ │ └── (llm, agentic-loop)
21
+ │ │ └── message ···················· [arc121]
22
+ │ │ └── session ················ [arc120]
23
+ │ │ └── (agentic-loop)
24
+ │ │
25
+ │ ├── system-prompt ·················· [arc105]
26
+ │ │ └── tool-definition ············ [arc106]
27
+ │ │ ├── tool-call ·············· [arc107]
28
+ │ │ │ └── tool-result ········ [arc108]
29
+ │ │ └── mcp ···················· [arc119]
30
+ │ │ └── (tool-call, tool-result)
31
+ │ │
32
+ │ └── reasoning-trace ················ [arc110]
33
+ │ ├── react-pattern ·············· [arc111]
34
+ │ │ └── (agentic-loop, tool-call, tool-result)
35
+ │ ├── reflexion-pattern ·········· [arc112]
36
+ │ │ └── (agentic-loop)
37
+ │ ├── tree-of-thoughts ··········· [arc113]
38
+ │ │ └── lats-pattern ··········· [arc115]
39
+ │ │ └── (agentic-loop, reflexion-pattern)
40
+ │ ├── self-consistency ··········· [arc114]
41
+ │ ├── plan-and-solve ············· [arc122]
42
+ │ └── extended-thinking ·········· [arc118]
43
+ │ └── (context-window)
44
+
45
+ └── repl ······························· [arc102]
46
+ └── agentic-loop ··················· [arc109]
47
+ ├── (llm, context-window, tool-call, tool-result)
48
+ └── subagent ··················· [arc117]
49
+ └── (context-window, tool-definition)
50
+ ```
51
+
52
+ ---
53
+
54
+ ## concept index
55
+
56
+ | arc# | concept | brief |
57
+ |------|---------|-------|
58
+ | 101 | llm | [arc101.concept.llm.[article].md](./arc101.concept.llm.[article].md) |
59
+ | 102 | repl | [arc102.concept.repl.[article].md](./arc102.concept.repl.[article].md) |
60
+ | 103 | replic-brain | [arc103.concept.replic-brain.[article].md](./arc103.concept.replic-brain.[article].md) |
61
+ | 104 | context-window | [arc104.concept.context-window.[article].md](./arc104.concept.context-window.[article].md) |
62
+ | 105 | system-prompt | [arc105.concept.system-prompt.[article].md](./arc105.concept.system-prompt.[article].md) |
63
+ | 106 | tool-definition | [arc106.concept.tool-definition.[article].md](./arc106.concept.tool-definition.[article].md) |
64
+ | 107 | tool-call | [arc107.concept.tool-call.[article].md](./arc107.concept.tool-call.[article].md) |
65
+ | 108 | tool-result | [arc108.concept.tool-result.[article].md](./arc108.concept.tool-result.[article].md) |
66
+ | 109 | agentic-loop | [arc109.concept.agentic-loop.[article].md](./arc109.concept.agentic-loop.[article].md) |
67
+ | 110 | reasoning-trace | [arc110.concept.reasoning-trace.[article].md](./arc110.concept.reasoning-trace.[article].md) |
68
+ | 111 | react-pattern | [arc111.concept.react-pattern.[article].md](./arc111.concept.react-pattern.[article].md) |
69
+ | 112 | reflexion-pattern | [arc112.concept.reflexion-pattern.[article].md](./arc112.concept.reflexion-pattern.[article].md) |
70
+ | 113 | tree-of-thoughts | [arc113.concept.tree-of-thoughts.[article].md](./arc113.concept.tree-of-thoughts.[article].md) |
71
+ | 114 | self-consistency | [arc114.concept.self-consistency.[article].md](./arc114.concept.self-consistency.[article].md) |
72
+ | 115 | lats-pattern | [arc115.concept.lats-pattern.[article].md](./arc115.concept.lats-pattern.[article].md) |
73
+ | 116 | context-compaction | [arc116.concept.context-compaction.[article].md](./arc116.concept.context-compaction.[article].md) |
74
+ | 117 | subagent | [arc117.concept.subagent.[article].md](./arc117.concept.subagent.[article].md) |
75
+ | 118 | extended-thinking | [arc118.concept.extended-thinking.[article].md](./arc118.concept.extended-thinking.[article].md) |
76
+ | 119 | mcp | [arc119.concept.mcp.[article].md](./arc119.concept.mcp.[article].md) |
77
+ | 120 | session | [arc120.concept.session.[article].md](./arc120.concept.session.[article].md) |
78
+ | 121 | message | [arc121.concept.message.[article].md](./arc121.concept.message.[article].md) |
79
+ | 122 | plan-and-solve | [arc122.concept.plan-and-solve.[article].md](./arc122.concept.plan-and-solve.[article].md) |
80
+
81
+ ---
82
+
83
+ ## layer analysis
84
+
85
+ ### foundational (no dependencies)
86
+ - `llm` — the reasoning engine
87
+ - `repl` — the interaction pattern
88
+
89
+ ### core infrastructure
90
+ - `context-window` — working memory
91
+ - `system-prompt` — behavior configuration
92
+ - `tool-definition` — capability schemas
93
+
94
+ ### execution layer
95
+ - `agentic-loop` — the orchestration pattern
96
+ - `tool-call` / `tool-result` — action interface
97
+ - `message` / `session` — conversation structure
98
+
99
+ ### reasoning strategies
100
+ - `reasoning-trace` — intermediate steps
101
+ - `react-pattern` — grounded reasoning
102
+ - `reflexion-pattern` — self-improvement
103
+ - `tree-of-thoughts` — deliberate search
104
+ - `self-consistency` — ensemble reasoning
105
+ - `lats-pattern` — learned search
106
+ - `plan-and-solve` — explicit planning
107
+ - `extended-thinking` — compute scaling
108
+
109
+ ### extensions
110
+ - `context-compaction` — memory management
111
+ - `subagent` — parallel/isolated execution
112
+ - `mcp` — tool standardization
113
+
114
+ ---
115
+
116
+ ## architectural insight
117
+
118
+ the treestruct reveals that replic brains are built from:
119
+
120
+ 1. **two primitives**: llm + repl
121
+ 2. **three constraints**: context-window, system-prompt, tool interface
122
+ 3. **one core loop**: agentic-loop
123
+ 4. **many reasoning strategies**: interchangeable approaches to improve quality
124
+ 5. **extension mechanisms**: compaction, subagents, protocols
125
+
126
+ different replic brains make different choices within this framework, but all share the same foundational structure.