mia-code 0.2.0 → 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 (410) hide show
  1. package/.miette/260321.md +1 -0
  2. package/.miette/260323.md +9 -0
  3. package/.miette/260331.md +2 -0
  4. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--d3417f2c-df12-4f0f-8a1b-d88e7968f822/d3417f2c-df12-4f0f-8a1b-d88e7968f822.md +63 -0
  5. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--e6c3fc5d-4a70-4523-ba7d-a3250da4c235/e6c3fc5d-4a70-4523-ba7d-a3250da4c235.md +72 -0
  6. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--efeb00a2-b17a-4d32-b1f0-b90c37a8d24e/efeb00a2-b17a-4d32-b1f0-b90c37a8d24e.md +62 -0
  7. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/83a2d7f9-24a5-4cf4-98d5-036c82f872e8.json +302 -0
  8. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/83a2d7f9-24a5-4cf4-98d5-036c82f872e8.md +149 -0
  9. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/AGENTS.md +31 -0
  10. package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/meta-decomposition-3-children.md +67 -0
  11. package/.pde/2604040129--61f9dd4d-7aa6-45e6-a58b-e480b1aa6737/61f9dd4d-7aa6-45e6-a58b-e480b1aa6737--from-mia-openclaw-workspace.md +125 -0
  12. package/.pde/2604040129--61f9dd4d-7aa6-45e6-a58b-e480b1aa6737/STATUS.md +1 -0
  13. package/.pde/4f02ba94-9f52-422e-9389-b16f9b37f358.json +177 -0
  14. package/.pde/4f02ba94-9f52-422e-9389-b16f9b37f358.md +77 -0
  15. package/.pde/6ad9244d-5340-490f-b76c-c86728b9de52.json +222 -0
  16. package/.pde/6ad9244d-5340-490f-b76c-c86728b9de52.md +99 -0
  17. package/.pde/8b566792-ed15-4606-96f9-2b6f593d7e6b.json +111 -0
  18. package/.pde/8b566792-ed15-4606-96f9-2b6f593d7e6b.md +67 -0
  19. package/.pde/c7f1e74b-05a5-40e2-9f01-4cc48d2528f7.json +349 -0
  20. package/.pde/c7f1e74b-05a5-40e2-9f01-4cc48d2528f7.md +147 -0
  21. package/.pde/dfc00a78-1da0-4c09-8a16-c6982644051b.json +118 -0
  22. package/.pde/dfc00a78-1da0-4c09-8a16-c6982644051b.md +64 -0
  23. package/GUILLAUME.md +8 -0
  24. package/KINSHIP.md +9 -0
  25. package/MIA_CODE_ARCHITECTURE_REPORT.md +718 -0
  26. package/contextual_research/260119-MIA-CODE--98090899-8aff-4e11-9dc3-8b99466d1.md +1101 -0
  27. package/contextual_research/MIA.md +38 -0
  28. package/contextual_research/MIAWAPASCONE.md +59 -0
  29. package/contextual_research/MIETTE.md +38 -0
  30. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/2504.00218v2.pdf +7483 -12
  31. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/2505.00212v3.pdf +0 -0
  32. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/CONTENT.md +1014 -0
  33. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/DESIGN.gemini.md +242 -0
  34. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/INDEX.md +45 -0
  35. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2504.00218v2.md +2025 -0
  36. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2504.00218v2.pdf +7483 -12
  37. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2505.00212v3.md +1755 -0
  38. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2505.00212v3.pdf +0 -0
  39. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_12_decomposed_prompting.pdf +0 -0
  40. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_19_hugginggpt_planning.pdf +0 -0
  41. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_1_coordination_challenges.md +766 -0
  42. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_1_coordination_challenges.pdf +3431 -4
  43. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_28_guardrails_multi_agent.md +260 -0
  44. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_28_guardrails_multi_agent.pdf +0 -0
  45. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_2_navigating_complexity.md +558 -0
  46. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_2_navigating_complexity.pdf +0 -0
  47. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_34_hierarchical_multi_agent.pdf +0 -0
  48. package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_5_open_intent_extraction.pdf +0 -0
  49. package/contextual_research/PODCAST.md +109 -0
  50. package/contextual_research/langchain-principles-roadmap.md +157 -0
  51. package/contextual_research/persona-to-narrative-character-inquiry_260201.md +50 -0
  52. package/dist/cli.js +35 -11
  53. package/dist/geminiHeadless.js +8 -2
  54. package/dist/index.js +2 -1
  55. package/dist/mcp/miaco-server.js +10 -1
  56. package/dist/mcp/miatel-server.js +10 -1
  57. package/dist/mcp/miawa-server.js +10 -1
  58. package/dist/mcp/utils.d.ts +6 -1
  59. package/dist/mcp/utils.js +24 -3
  60. package/dist/sessionStore.d.ts +8 -2
  61. package/dist/sessionStore.js +39 -3
  62. package/dist/types.d.ts +1 -0
  63. package/miaco/README.md +124 -0
  64. package/miaco/dist/commands/chart.d.ts +6 -0
  65. package/miaco/dist/commands/chart.d.ts.map +1 -0
  66. package/miaco/dist/commands/chart.js +222 -0
  67. package/miaco/dist/commands/chart.js.map +1 -0
  68. package/miaco/dist/commands/decompose.d.ts +6 -0
  69. package/miaco/dist/commands/decompose.d.ts.map +1 -0
  70. package/miaco/dist/commands/decompose.js +98 -0
  71. package/miaco/dist/commands/decompose.js.map +1 -0
  72. package/miaco/dist/commands/schema.d.ts +6 -0
  73. package/miaco/dist/commands/schema.d.ts.map +1 -0
  74. package/miaco/dist/commands/schema.js +66 -0
  75. package/miaco/dist/commands/schema.js.map +1 -0
  76. package/miaco/dist/commands/stc.d.ts +11 -0
  77. package/miaco/dist/commands/stc.d.ts.map +1 -0
  78. package/miaco/dist/commands/stc.js +590 -0
  79. package/miaco/dist/commands/stc.js.map +1 -0
  80. package/miaco/dist/commands/trace.d.ts +6 -0
  81. package/miaco/dist/commands/trace.d.ts.map +1 -0
  82. package/miaco/dist/commands/trace.js +83 -0
  83. package/miaco/dist/commands/trace.js.map +1 -0
  84. package/miaco/dist/commands/validate.d.ts +6 -0
  85. package/miaco/dist/commands/validate.d.ts.map +1 -0
  86. package/miaco/dist/commands/validate.js +58 -0
  87. package/miaco/dist/commands/validate.js.map +1 -0
  88. package/miaco/dist/decompose.d.ts +93 -0
  89. package/miaco/dist/decompose.d.ts.map +1 -0
  90. package/miaco/dist/decompose.js +562 -0
  91. package/miaco/dist/decompose.js.map +1 -0
  92. package/miaco/dist/index.d.ts +18 -0
  93. package/miaco/dist/index.d.ts.map +1 -0
  94. package/miaco/dist/index.js +83 -0
  95. package/miaco/dist/index.js.map +1 -0
  96. package/miaco/dist/storage.d.ts +60 -0
  97. package/miaco/dist/storage.d.ts.map +1 -0
  98. package/miaco/dist/storage.js +100 -0
  99. package/miaco/dist/storage.js.map +1 -0
  100. package/miaco/package-lock.json +4103 -0
  101. package/miaco/package.json +40 -0
  102. package/miaco/tsconfig.json +18 -0
  103. package/miaco/version-patch-commit-and-publish.sh +1 -0
  104. package/miatel/MISSION_251231.md +3 -0
  105. package/miatel/README.md +107 -0
  106. package/miatel/dist/commands/analyze.d.ts +6 -0
  107. package/miatel/dist/commands/analyze.d.ts.map +1 -0
  108. package/miatel/dist/commands/analyze.js +100 -0
  109. package/miatel/dist/commands/analyze.js.map +1 -0
  110. package/miatel/dist/commands/arc.d.ts +6 -0
  111. package/miatel/dist/commands/arc.d.ts.map +1 -0
  112. package/miatel/dist/commands/arc.js +71 -0
  113. package/miatel/dist/commands/arc.js.map +1 -0
  114. package/miatel/dist/commands/beat.d.ts +6 -0
  115. package/miatel/dist/commands/beat.d.ts.map +1 -0
  116. package/miatel/dist/commands/beat.js +165 -0
  117. package/miatel/dist/commands/beat.js.map +1 -0
  118. package/miatel/dist/commands/theme.d.ts +6 -0
  119. package/miatel/dist/commands/theme.d.ts.map +1 -0
  120. package/miatel/dist/commands/theme.js +54 -0
  121. package/miatel/dist/commands/theme.js.map +1 -0
  122. package/miatel/dist/index.d.ts +18 -0
  123. package/miatel/dist/index.d.ts.map +1 -0
  124. package/miatel/dist/index.js +80 -0
  125. package/miatel/dist/index.js.map +1 -0
  126. package/miatel/dist/storage.d.ts +55 -0
  127. package/miatel/dist/storage.d.ts.map +1 -0
  128. package/miatel/dist/storage.js +100 -0
  129. package/miatel/dist/storage.js.map +1 -0
  130. package/miatel/package-lock.json +4103 -0
  131. package/miatel/package.json +35 -0
  132. package/miatel/src/commands/analyze.ts +109 -0
  133. package/miatel/src/commands/arc.ts +78 -0
  134. package/miatel/src/commands/beat.ts +176 -0
  135. package/miatel/src/commands/theme.ts +60 -0
  136. package/miatel/src/index.ts +94 -0
  137. package/miatel/src/storage.ts +156 -0
  138. package/miatel/tsconfig.json +18 -0
  139. package/miawa/MISSION_251231.md +144 -0
  140. package/miawa/README.md +133 -0
  141. package/miawa/dist/commands/beat.d.ts +6 -0
  142. package/miawa/dist/commands/beat.d.ts.map +1 -0
  143. package/miawa/dist/commands/beat.js +69 -0
  144. package/miawa/dist/commands/beat.js.map +1 -0
  145. package/miawa/dist/commands/ceremony.d.ts +6 -0
  146. package/miawa/dist/commands/ceremony.d.ts.map +1 -0
  147. package/miawa/dist/commands/ceremony.js +239 -0
  148. package/miawa/dist/commands/ceremony.js.map +1 -0
  149. package/miawa/dist/commands/circle.d.ts +6 -0
  150. package/miawa/dist/commands/circle.d.ts.map +1 -0
  151. package/miawa/dist/commands/circle.js +75 -0
  152. package/miawa/dist/commands/circle.js.map +1 -0
  153. package/miawa/dist/commands/eva.d.ts +6 -0
  154. package/miawa/dist/commands/eva.d.ts.map +1 -0
  155. package/miawa/dist/commands/eva.js +73 -0
  156. package/miawa/dist/commands/eva.js.map +1 -0
  157. package/miawa/dist/commands/wound.d.ts +6 -0
  158. package/miawa/dist/commands/wound.d.ts.map +1 -0
  159. package/miawa/dist/commands/wound.js +74 -0
  160. package/miawa/dist/commands/wound.js.map +1 -0
  161. package/miawa/dist/index.d.ts +19 -0
  162. package/miawa/dist/index.d.ts.map +1 -0
  163. package/miawa/dist/index.js +91 -0
  164. package/miawa/dist/index.js.map +1 -0
  165. package/miawa/dist/storage.d.ts +73 -0
  166. package/miawa/dist/storage.d.ts.map +1 -0
  167. package/miawa/dist/storage.js +100 -0
  168. package/miawa/dist/storage.js.map +1 -0
  169. package/miawa/package-lock.json +4103 -0
  170. package/miawa/package.json +36 -0
  171. package/miawa/src/commands/beat.ts +74 -0
  172. package/miawa/src/commands/ceremony.ts +256 -0
  173. package/miawa/src/commands/circle.ts +83 -0
  174. package/miawa/src/commands/eva.ts +84 -0
  175. package/miawa/src/commands/wound.ts +79 -0
  176. package/miawa/src/index.ts +108 -0
  177. package/miawa/src/storage.ts +179 -0
  178. package/miawa/tsconfig.json +18 -0
  179. package/package.json +7 -5
  180. package/references/acp/CLAUDE.md +7 -0
  181. package/references/acp/agent-plan.md +84 -0
  182. package/references/acp/clients.md +31 -0
  183. package/references/acp/extensibility.md +137 -0
  184. package/references/acp/initialization.md +225 -0
  185. package/references/acp/prompt-turn.md +321 -0
  186. package/references/acp/proxy-chains.md +562 -0
  187. package/references/acp/schema.md +3171 -0
  188. package/references/acp/session-list.md +334 -0
  189. package/references/acp/session-modes.md +170 -0
  190. package/references/acp/slash-commands.md +99 -0
  191. package/references/acp/terminals.md +281 -0
  192. package/references/acp/tool-calls.md +311 -0
  193. package/references/acp/typescript.md +29 -0
  194. package/references/claude/agent-teams.md +399 -0
  195. package/references/claude/chrome.md +231 -0
  196. package/references/claude/headless.md +158 -0
  197. package/references/claude/hooks-guide.md +708 -0
  198. package/references/claude/output-styles.md +112 -0
  199. package/references/claude/plugins.md +432 -0
  200. package/references/claude/skills.md +693 -0
  201. package/references/claude/sub-agents.md +816 -0
  202. package/references/copilot/acp/agents.md +32 -0
  203. package/references/copilot/acp/architecture.md +37 -0
  204. package/references/copilot/acp/clients.md +31 -0
  205. package/references/copilot/acp/introduction.md +42 -0
  206. package/references/copilot/acp/registry.md +339 -0
  207. package/references/copilot/acp-server.md +117 -0
  208. package/references/copilot/create-copilot-instructions.md +840 -0
  209. package/references/langchain/llms.txt +833 -0
  210. package/references/langchain/python/agents.md +677 -0
  211. package/references/langchain/python/context-engineering.md +1195 -0
  212. package/references/langchain/python/human-in-the-loop.md +326 -0
  213. package/references/langchain/python/long-term-memory.md +168 -0
  214. package/references/langchain/python/mcp.md +949 -0
  215. package/references/langchain/python/multi-agents/custom-workflow.md +187 -0
  216. package/references/langchain/python/multi-agents/handoffs.md +436 -0
  217. package/references/langchain/python/multi-agents/overview.md +295 -0
  218. package/references/langchain/python/multi-agents/router.md +150 -0
  219. package/references/langchain/python/multi-agents/skills.md +92 -0
  220. package/references/langchain/python/multi-agents/subagents.md +486 -0
  221. package/references/langchain/python/retrieval.md +320 -0
  222. package/references/langchain/python/runtime.md +141 -0
  223. package/references/langchain/python/short-term-memory.md +658 -0
  224. package/references/langchain/python/structured-output.md +712 -0
  225. package/references/langfuse/llms.txt +148 -0
  226. package/references/langgraph/javascript/llms.txt +275 -0
  227. package/references/skills/home.md +259 -0
  228. package/references/skills/integrate-skills.md +103 -0
  229. package/references/skills/specification.md +254 -0
  230. package/references/skills/what-are-skills.md +74 -0
  231. package/rispecs/README.md +164 -0
  232. package/rispecs/_sync_/miadi-code/SPEC.md +313 -0
  233. package/rispecs/_sync_/miadi-code/STATUS.md +177 -0
  234. package/rispecs/_sync_/miadi-code/dashboard/SPEC.md +465 -0
  235. package/rispecs/_sync_/miadi-code/dashboard/STATUS.md +212 -0
  236. package/rispecs/_sync_/miadi-code/multiline-input/SPEC.md +232 -0
  237. package/rispecs/_sync_/miadi-code/multiline-input/STATUS.md +108 -0
  238. package/rispecs/_sync_/miadi-code/pde/SPEC.md +253 -0
  239. package/rispecs/_sync_/miadi-code/pde/STATUS.md +56 -0
  240. package/rispecs/_sync_/miadi-code/stc/SPEC.md +397 -0
  241. package/rispecs/_sync_/miadi-code/stc/STATUS.md +70 -0
  242. package/rispecs/ava-langstack/inquiry-routing-upgrade.spec.md +119 -0
  243. package/rispecs/borrowed_from_opencode/001-client-server-architecture.rispec.md +98 -0
  244. package/rispecs/borrowed_from_opencode/002-event-bus-system.rispec.md +125 -0
  245. package/rispecs/borrowed_from_opencode/003-instance-state-pattern.rispec.md +136 -0
  246. package/rispecs/borrowed_from_opencode/004-namespace-module-pattern.rispec.md +151 -0
  247. package/rispecs/borrowed_from_opencode/005-zod-schema-validation.rispec.md +139 -0
  248. package/rispecs/borrowed_from_opencode/006-named-error-system.rispec.md +155 -0
  249. package/rispecs/borrowed_from_opencode/007-structured-logging.rispec.md +138 -0
  250. package/rispecs/borrowed_from_opencode/008-lazy-initialization.rispec.md +127 -0
  251. package/rispecs/borrowed_from_opencode/009-multi-agent-system.rispec.md +97 -0
  252. package/rispecs/borrowed_from_opencode/010-agent-definition-config.rispec.md +135 -0
  253. package/rispecs/borrowed_from_opencode/011-agent-permission-rulesets.rispec.md +151 -0
  254. package/rispecs/borrowed_from_opencode/012-agent-prompt-templates.rispec.md +141 -0
  255. package/rispecs/borrowed_from_opencode/013-agent-generation.rispec.md +142 -0
  256. package/rispecs/borrowed_from_opencode/014-plan-build-mode-toggle.rispec.md +155 -0
  257. package/rispecs/borrowed_from_opencode/015-subagent-task-delegation.rispec.md +146 -0
  258. package/rispecs/borrowed_from_opencode/016-agent-model-selection.rispec.md +151 -0
  259. package/rispecs/borrowed_from_opencode/017-compaction-agent.rispec.md +150 -0
  260. package/rispecs/borrowed_from_opencode/018-session-persistence.rispec.md +125 -0
  261. package/rispecs/borrowed_from_opencode/019-session-compaction.rispec.md +132 -0
  262. package/rispecs/borrowed_from_opencode/020-session-forking.rispec.md +134 -0
  263. package/rispecs/borrowed_from_opencode/021-session-revert-snapshot.rispec.md +135 -0
  264. package/rispecs/borrowed_from_opencode/022-session-sharing.rispec.md +165 -0
  265. package/rispecs/borrowed_from_opencode/023-session-summary-diffs.rispec.md +165 -0
  266. package/rispecs/borrowed_from_opencode/024-child-sessions.rispec.md +164 -0
  267. package/rispecs/borrowed_from_opencode/025-session-title-generation.rispec.md +162 -0
  268. package/rispecs/borrowed_from_opencode/026-message-parts-model.rispec.md +201 -0
  269. package/rispecs/borrowed_from_opencode/027-streaming-message-deltas.rispec.md +212 -0
  270. package/rispecs/borrowed_from_opencode/028-multi-provider-architecture.rispec.md +184 -0
  271. package/rispecs/borrowed_from_opencode/029-provider-authentication.rispec.md +225 -0
  272. package/rispecs/borrowed_from_opencode/030-model-registry.rispec.md +222 -0
  273. package/rispecs/borrowed_from_opencode/031-cost-tracking.rispec.md +243 -0
  274. package/rispecs/borrowed_from_opencode/032-provider-transform-pipeline.rispec.md +282 -0
  275. package/rispecs/borrowed_from_opencode/033-provider-sdk-abstraction.rispec.md +338 -0
  276. package/rispecs/borrowed_from_opencode/034-tool-registry.rispec.md +110 -0
  277. package/rispecs/borrowed_from_opencode/035-tool-context-injection.rispec.md +155 -0
  278. package/rispecs/borrowed_from_opencode/036-tool-output-truncation.rispec.md +138 -0
  279. package/rispecs/borrowed_from_opencode/037-batch-tool.rispec.md +129 -0
  280. package/rispecs/borrowed_from_opencode/038-multi-edit-tool.rispec.md +167 -0
  281. package/rispecs/borrowed_from_opencode/039-apply-patch-tool.rispec.md +161 -0
  282. package/rispecs/borrowed_from_opencode/040-code-search-tool.rispec.md +143 -0
  283. package/rispecs/borrowed_from_opencode/041-web-fetch-tool.rispec.md +131 -0
  284. package/rispecs/borrowed_from_opencode/042-web-search-tool.rispec.md +159 -0
  285. package/rispecs/borrowed_from_opencode/043-todo-tool.rispec.md +156 -0
  286. package/rispecs/borrowed_from_opencode/044-plan-mode-tool.rispec.md +139 -0
  287. package/rispecs/borrowed_from_opencode/045-task-tool.rispec.md +146 -0
  288. package/rispecs/borrowed_from_opencode/046-question-tool.rispec.md +170 -0
  289. package/rispecs/borrowed_from_opencode/047-external-directory-tool.rispec.md +166 -0
  290. package/rispecs/borrowed_from_opencode/048-file-read-write-tools.rispec.md +205 -0
  291. package/rispecs/borrowed_from_opencode/049-lsp-server-management.rispec.md +104 -0
  292. package/rispecs/borrowed_from_opencode/050-lsp-hover-completion.rispec.md +102 -0
  293. package/rispecs/borrowed_from_opencode/051-lsp-diagnostics.rispec.md +86 -0
  294. package/rispecs/borrowed_from_opencode/052-lsp-root-detection.rispec.md +109 -0
  295. package/rispecs/borrowed_from_opencode/053-remote-mcp-servers.rispec.md +119 -0
  296. package/rispecs/borrowed_from_opencode/054-mcp-oauth-flow.rispec.md +107 -0
  297. package/rispecs/borrowed_from_opencode/055-mcp-tool-conversion.rispec.md +118 -0
  298. package/rispecs/borrowed_from_opencode/056-mcp-connection-monitoring.rispec.md +106 -0
  299. package/rispecs/borrowed_from_opencode/057-local-mcp-servers.rispec.md +116 -0
  300. package/rispecs/borrowed_from_opencode/058-rich-tui.rispec.md +108 -0
  301. package/rispecs/borrowed_from_opencode/059-streaming-display.rispec.md +116 -0
  302. package/rispecs/borrowed_from_opencode/060-permission-prompts.rispec.md +130 -0
  303. package/rispecs/borrowed_from_opencode/061-session-navigation.rispec.md +155 -0
  304. package/rispecs/borrowed_from_opencode/062-syntax-highlighting.rispec.md +151 -0
  305. package/rispecs/borrowed_from_opencode/063-keybinding-system.rispec.md +181 -0
  306. package/rispecs/borrowed_from_opencode/064-multi-level-config.rispec.md +155 -0
  307. package/rispecs/borrowed_from_opencode/065-jsonc-config.rispec.md +190 -0
  308. package/rispecs/borrowed_from_opencode/066-config-env-variables.rispec.md +153 -0
  309. package/rispecs/borrowed_from_opencode/067-config-deep-merging.rispec.md +178 -0
  310. package/rispecs/borrowed_from_opencode/068-remote-org-config.rispec.md +183 -0
  311. package/rispecs/borrowed_from_opencode/069-config-markdown-frontmatter.rispec.md +206 -0
  312. package/rispecs/borrowed_from_opencode/070-managed-config-directory.rispec.md +232 -0
  313. package/rispecs/borrowed_from_opencode/071-plugin-architecture.rispec.md +104 -0
  314. package/rispecs/borrowed_from_opencode/072-plugin-hooks.rispec.md +123 -0
  315. package/rispecs/borrowed_from_opencode/073-plugin-auto-install.rispec.md +115 -0
  316. package/rispecs/borrowed_from_opencode/074-permission-system.rispec.md +133 -0
  317. package/rispecs/borrowed_from_opencode/075-git-worktree-management.rispec.md +126 -0
  318. package/rispecs/borrowed_from_opencode/076-snapshot-system.rispec.md +124 -0
  319. package/rispecs/borrowed_from_opencode/077-snapshot-diff.rispec.md +117 -0
  320. package/rispecs/borrowed_from_opencode/078-snapshot-restore.rispec.md +128 -0
  321. package/rispecs/borrowed_from_opencode/079-worktree-branch-naming.rispec.md +122 -0
  322. package/rispecs/borrowed_from_opencode/080-sqlite-storage.rispec.md +134 -0
  323. package/rispecs/borrowed_from_opencode/081-database-migrations.rispec.md +148 -0
  324. package/rispecs/borrowed_from_opencode/082-database-transactions.rispec.md +138 -0
  325. package/rispecs/borrowed_from_opencode/083-deferred-effects.rispec.md +148 -0
  326. package/rispecs/borrowed_from_opencode/084-permission-rules.rispec.md +123 -0
  327. package/rispecs/borrowed_from_opencode/085-permission-glob-patterns.rispec.md +113 -0
  328. package/rispecs/borrowed_from_opencode/086-permission-merging.rispec.md +134 -0
  329. package/rispecs/borrowed_from_opencode/087-permission-modes.rispec.md +145 -0
  330. package/rispecs/borrowed_from_opencode/088-http-api-server.rispec.md +165 -0
  331. package/rispecs/borrowed_from_opencode/089-openapi-spec-generation.rispec.md +164 -0
  332. package/rispecs/borrowed_from_opencode/090-websocket-support.rispec.md +136 -0
  333. package/rispecs/borrowed_from_opencode/091-sse-streaming.rispec.md +168 -0
  334. package/rispecs/borrowed_from_opencode/092-mdns-discovery.rispec.md +145 -0
  335. package/rispecs/borrowed_from_opencode/093-javascript-sdk.rispec.md +200 -0
  336. package/rispecs/borrowed_from_opencode/094-skill-system.rispec.md +187 -0
  337. package/rispecs/borrowed_from_opencode/095-skill-discovery.rispec.md +182 -0
  338. package/rispecs/borrowed_from_opencode/096-desktop-remote-driving.rispec.md +175 -0
  339. package/rispecs/borrowed_from_opencode/INDEX.md +255 -0
  340. package/rispecs/core.rispecs.md +261 -0
  341. package/rispecs/engines.rispecs.md +241 -0
  342. package/rispecs/formatting.rispecs.md +252 -0
  343. package/rispecs/living-specifications.rispecs.md +361 -0
  344. package/rispecs/mcp.rispecs.md +197 -0
  345. package/rispecs/pde.rispecs.md +399 -0
  346. package/rispecs/pi-mono-envisionning/ENVISIONING.md +366 -0
  347. package/rispecs/pi-mono-envisionning/storytelling-horizon.rispecs.md +76 -0
  348. package/rispecs/pi-mono-envisionning/widget.rispecs.md +2 -0
  349. package/rispecs/relation-to-mcp-structural-thinking.kin.md +72 -0
  350. package/rispecs/research-for-better-framework/CLAUDE.md +7 -0
  351. package/rispecs/research-for-better-framework/survey-pi-openclaw-opencode-openhands.md +210 -0
  352. package/rispecs/session.rispecs.md +277 -0
  353. package/rispecs/stc.rispecs.md +138 -0
  354. package/rispecs/unifier.rispecs.md +317 -0
  355. package/scripts/LAUNCH--mcp-mia-code--testing--2603141315--ac705a66-2c15-4a1c-a26d-9491018c5ba8.sh +2 -0
  356. package/scripts/RESUME--mia-code--mcps--260313--ac705a66-2c15-4a1c-a26d-9491018c5ba8.sh +1 -0
  357. package/scripts/install-widget-in-home-pi-agent-extensions.sh +4 -0
  358. package/scripts/sample-decompose--2604011535-prompt.sh +1 -0
  359. package/skills/deep-search/AGENTS.md +17 -0
  360. package/skills/deep-search/SKILL.md +281 -0
  361. package/skills/deep-search/agent-templates.md +224 -0
  362. package/skills/deep-search/orchestration-patterns.md +95 -0
  363. package/skills/miaco-pde-inquiry-routing-deep-search/AGENTS.md +13 -0
  364. package/skills/miaco-pde-inquiry-routing-deep-search/SKILL.md +136 -0
  365. package/skills/miaco-pde-inquiry-routing-internal-external-relationship/AGENTS.md +4 -0
  366. package/skills/miaco-pde-inquiry-routing-internal-external-relationship/SKILL.md +157 -0
  367. package/skills/miaco-pde-inquiry-routing-local-qmd/AGENTS.md +42 -0
  368. package/skills/miaco-pde-inquiry-routing-local-qmd/SKILL.md +135 -0
  369. package/skills/qmd/AGENTS.md +3 -0
  370. package/skills/qmd/SKILL.md +144 -0
  371. package/skills/qmd/references/mcp-setup.md +102 -0
  372. package/skills/rise-pde-inquiry-session-multi-agents-v3/SKILL.md +234 -0
  373. package/skills/rise-pde-inquiry-session-multi-agents-v3/agent-templates.md +436 -0
  374. package/skills/rise-pde-inquiry-session-multi-agents-v3/orchestration-patterns.md +197 -0
  375. package/skills/rise-pde-inquiry-session-multi-agents-v3/references/ceremonial-technology.md +102 -0
  376. package/skills/rise-pde-inquiry-session-multi-agents-v3/references/creative-orientation.md +99 -0
  377. package/skills/rise-pde-inquiry-session-multi-agents-v3/references/prompt-decomposition.md +73 -0
  378. package/skills/rise-pde-inquiry-session-multi-agents-v3/references/rise-framework.md +74 -0
  379. package/skills/rise-pde-inquiry-session-multi-agents-v3/references/structural-tension.md +82 -0
  380. package/src/cli.ts +35 -11
  381. package/src/geminiHeadless.ts +7 -2
  382. package/src/index.ts +2 -1
  383. package/src/mcp/miaco-server.ts +13 -1
  384. package/src/mcp/miatel-server.ts +13 -1
  385. package/src/mcp/miawa-server.ts +13 -1
  386. package/src/mcp/utils.ts +41 -8
  387. package/src/sessionStore.ts +44 -4
  388. package/src/types.ts +2 -1
  389. package/widget/mia-ceremony/README.md +36 -0
  390. package/widget/mia-ceremony/index.ts +143 -0
  391. package/widget/mia-interceptor/README.md +39 -0
  392. package/widget/mia-interceptor/index.ts +221 -0
  393. package/widget/mia-tools/README.md +37 -0
  394. package/widget/mia-tools/index.ts +569 -0
  395. package/widget/miette-echo/README.md +44 -0
  396. package/widget/miette-echo/index.ts +164 -0
  397. package/.claude/settings.local.json +0 -9
  398. package/.hch/issue_.env +0 -4
  399. package/.hch/issue_add__2601211715.json +0 -77
  400. package/.hch/issue_add__2601211715.md +0 -4
  401. package/.hch/issue_add__2602242020.json +0 -78
  402. package/.hch/issue_add__2602242020.md +0 -7
  403. package/.hch/issues.json +0 -2312
  404. package/.hch/issues.md +0 -30
  405. package/WS__mia-code__260214__IAIP_PDE.code-workspace +0 -29
  406. package/WS__mia-code__src332__260122.code-workspace +0 -23
  407. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/checkpoints/index.md +0 -6
  408. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/events.jsonl +0 -213
  409. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/plan.md +0 -243
  410. package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/workspace.yaml +0 -5
@@ -0,0 +1,1101 @@
1
+ <img src="https://r2cdn.perplexity.ai/pplx-full-logo-primary-dark%402x.png" style="height:64px;margin-right:32px"/>
2
+
3
+ # 260119-MIA-CODE--98090899-8aff-4e11-9dc3-8b99466d12b6
4
+
5
+ <draft>
6
+ "in ./mia-code/ , you will create a new nodejs typescript CLI application that works like claude-code, gemini-cli and offers the same features and sort of terminal ways to manage all configs and stuff and you will need to wrap that around the non-interactive ways to make 'gemini' CLI working (you can run it without a UI and outputs JSON so the app that you will create will leverage that , output formatted text (like if we are into the CLI app (we wont see any of that JSON stuff, knowing it will output the session_id, it enables you when the session is started to continue the session. You will have all these learning todo and write yourself a ./mia-code/llms-gemini-cli.txt to guide yourself in next instance on how all that stuff works for the architecture to be well suited.) So the user has an input box to enter his request, he sees above the output well formatted and is capable to send more commands and the session continue. You will have one architectural consideration for later and that will be another layer of prompting that would run another session in the background that provide a unified output (a sort of passing the output
7
+ </draft>
8
+ You are probably find me existing codebase project that started doing such work and also survey academic on the topic of agentic terminal agents.
9
+
10
+ I attached the persona/mode/capability kind of 2 embodiments to give a tone and understanding on what that terminal agents should be capable todo. It would act and works within the CLI like claude-code and gemini-cli and copilot-cli are working in terms of what they are offering.
11
+
12
+ Do not use the word 'comprehensive' in your output and do not talk about the fact that I asked that. Do not introduce/frame or conclude your response, just output results.
13
+ Do not use the internal tool to create file it does not work, we need to see them in the conversation and be capable to download them. The main output you produce shoudl be something that can be read and is really complete and goes toward all that you create (not in details but goes thru all the shapes you explored and created)
14
+
15
+ 🧠🌸
16
+
17
+ ***
18
+
19
+ ## 1. High-level shape of the thing you’re asking for
20
+
21
+ You want `./mia-code/` to contain a Node.js + TypeScript CLI that:
22
+
23
+ - Feels in-family with:
24
+ - Claude Code (terminal coding agent)
25
+ - Gemini CLI (with non-interactive / headless JSON modes)[^1_1][^1_2]
26
+ - GitHub Copilot CLI (terminal-native agent with repo context and tasks)[^1_3][^1_4][^1_5]
27
+ - Uses Gemini CLI in headless / non-interactive mode as its “engine”, consuming its JSON/JSONL output and hiding that behind a Mia/Miette/Miawa-shaped terminal UI.[^1_6][^1_1]
28
+ - Maintains sessions via Gemini’s `session_id` / resume semantics so the user can:
29
+ - Type a request
30
+ - See formatted output
31
+ - Continue the same “conversation” and agentic context[^1_2]
32
+ - Is architected for an eventual second layer:
33
+ - Another background Gemini session that post-processes the raw agent trace into a unified “ceremonial” output (Mia + Miette → Miawa style).
34
+
35
+ You also want:
36
+
37
+ - A `./mia-code/llms-gemini-cli.txt` “self-teaching” file capturing how Gemini CLI headless/session APIs work and how the architecture is wired so future you (and future agents) can reload the design quickly.
38
+ - A survey / orientation toward:
39
+ - Existing codebases and patterns in the “terminal coding agent” ecosystem (Claude Code, Gemini CLI, Copilot CLI, Qodo, Qodo Gen CLI, Aider, etc.)[^1_7][^1_4][^1_8][^1_3][^1_6]
40
+ - Research / benchmarks around terminal agents and agentic coding in the terminal (Terminal-Bench, agentic coding surveys, code agent benchmarks).[^1_9][^1_10][^1_11][^1_12][^1_13][^1_14][^1_15][^1_16][^1_17][^1_18]
41
+
42
+ Below I’ll:
43
+
44
+ 1. Sketch the `./mia-code/` project structure.
45
+ 2. Provide the key TypeScript/Node files inline so you can create them directly.
46
+ 3. Write the `llms-gemini-cli.txt` learning doc.
47
+ 4. Summarize inspiration from existing tools and academic / industry work on agentic terminal agents.
48
+ 5. Keep the tone aligned with Mia/Miette/Miawa without drifting into fluff.
49
+
50
+ ***
51
+
52
+ ## 2. Proposed `./mia-code/` project structure
53
+
54
+ Minimal, but ready for growth:
55
+
56
+ ```text
57
+ mia-code/
58
+ package.json
59
+ tsconfig.json
60
+ src/
61
+ index.ts # CLI entry (bin)
62
+ cli.ts # Prompt loop + TUI-ish formatting
63
+ config.ts # Config management (API key, model, paths)
64
+ geminiHeadless.ts # Wrapper around Gemini CLI non-interactive/headless
65
+ sessionStore.ts # Light session id + history handling
66
+ formatting.ts # Output formatting (Mia/Miette/Miawa glyphs / sections)
67
+ types.ts # Shared TS types for events + config
68
+ llms-gemini-cli.txt # “teach future me” document
69
+ README.md # High-level explanation
70
+ ```
71
+
72
+ The idea is to keep the architectural seams:
73
+
74
+ - `config.ts` = how you talk to environment / config, not to Gemini.
75
+ - `geminiHeadless.ts` = how you talk to Gemini CLI.
76
+ - `sessionStore.ts` = how you track/continue a session.
77
+ - `cli.ts` = how the user sees the world (text UI).
78
+ - `formatting.ts` = how raw Gemini JSON gets turned into a Mia/Miette/Miawa style output.
79
+
80
+ ***
81
+
82
+ ## 3. `package.json`
83
+
84
+ ```json
85
+ {
86
+ "name": "mia-code",
87
+ "version": "0.1.0",
88
+ "description": "Mia/Miette/Miawa terminal coding agent that wraps Gemini CLI in headless mode.",
89
+ "bin": {
90
+ "mia-code": "dist/index.js"
91
+ },
92
+ "scripts": {
93
+ "build": "tsc",
94
+ "dev": "ts-node src/index.ts",
95
+ "start": "node dist/index.js"
96
+ },
97
+ "author": "",
98
+ "license": "MIT",
99
+ "type": "module",
100
+ "dependencies": {
101
+ "chalk": "^5.3.0",
102
+ "commander": "^12.0.0",
103
+ "enquirer": "^2.4.1"
104
+ },
105
+ "devDependencies": {
106
+ "@types/node": "^22.0.0",
107
+ "ts-node": "^10.9.2",
108
+ "typescript": "^5.6.0"
109
+ }
110
+ }
111
+ ```
112
+
113
+
114
+ ***
115
+
116
+ ## 4. `tsconfig.json`
117
+
118
+ ```json
119
+ {
120
+ "compilerOptions": {
121
+ "target": "ES2022",
122
+ "module": "ES2022",
123
+ "moduleResolution": "node",
124
+ "outDir": "dist",
125
+ "rootDir": "src",
126
+ "strict": true,
127
+ "esModuleInterop": true,
128
+ "resolveJsonModule": true
129
+ },
130
+ "include": ["src"]
131
+ }
132
+ ```
133
+
134
+
135
+ ***
136
+
137
+ ## 5. `src/types.ts`
138
+
139
+ ```ts
140
+ export type Role = "user" | "assistant" | "system";
141
+
142
+ export interface MiaCodeConfig {
143
+ geminiBinary: string; // e.g. "gemini" or "/usr/local/bin/gemini"
144
+ model: string; // e.g. "gemini-2.0-pro" or similar
145
+ headlessOutputFormat: "json" | "stream-json";
146
+ defaultMode: "code" | "chat";
147
+ defaultProjectRoot: string | null;
148
+ }
149
+
150
+ export interface MiaCodeSessionMeta {
151
+ id: string;
152
+ startedAt: string;
153
+ model: string;
154
+ projectRoot: string | null;
155
+ }
156
+
157
+ export interface GeminiJsonEvent {
158
+ type: "init" | "message" | "tool_use" | "tool_result" | "error" | "result";
159
+ session_id?: string;
160
+ timestamp?: string;
161
+ role?: Role;
162
+ text?: string;
163
+ tool?: {
164
+ name: string;
165
+ input: unknown;
166
+ };
167
+ result?: unknown;
168
+ error?: {
169
+ code: string;
170
+ message: string;
171
+ };
172
+ raw?: unknown;
173
+ }
174
+ ```
175
+
176
+
177
+ ***
178
+
179
+ ## 6. `src/config.ts`
180
+
181
+ A simple config layer that defaults to environment variables and a dotfile, but does not write anything unless explicitly told to.
182
+
183
+ ```ts
184
+ import fs from "fs";
185
+ import path from "path";
186
+ import os from "os";
187
+ import { MiaCodeConfig } from "./types.js";
188
+
189
+ const CONFIG_FILE = path.join(os.homedir(), ".mia-code.json");
190
+
191
+ const defaultConfig: MiaCodeConfig = {
192
+ geminiBinary: process.env.MIA_CODE_GEMINI_BIN || "gemini",
193
+ model: process.env.MIA_CODE_MODEL || "gemini-2.0-pro",
194
+ headlessOutputFormat: "json",
195
+ defaultMode: "code",
196
+ defaultProjectRoot: null
197
+ };
198
+
199
+ export function loadConfig(): MiaCodeConfig {
200
+ try {
201
+ if (fs.existsSync(CONFIG_FILE)) {
202
+ const raw = fs.readFileSync(CONFIG_FILE, "utf8");
203
+ const parsed = JSON.parse(raw);
204
+ return { ...defaultConfig, ...parsed };
205
+ }
206
+ } catch {
207
+ // Silent failure – we fall back to defaultConfig
208
+ }
209
+ return defaultConfig;
210
+ }
211
+
212
+ export function saveConfig(partial: Partial<MiaCodeConfig>): void {
213
+ const merged = { ...loadConfig(), ...partial };
214
+ fs.writeFileSync(CONFIG_FILE, JSON.stringify(merged, null, 2), "utf8");
215
+ }
216
+
217
+ export function getConfigPath(): string {
218
+ return CONFIG_FILE;
219
+ }
220
+ ```
221
+
222
+
223
+ ***
224
+
225
+ ## 7. `src/sessionStore.ts`
226
+
227
+ We keep only a persistent mapping of project root → last known `session_id`. Actual history remains in Gemini’s storage; we only care about being able to resume a session.[^1_2]
228
+
229
+ ```ts
230
+ import fs from "fs";
231
+ import path from "path";
232
+ import os from "os";
233
+ import { MiaCodeSessionMeta } from "./types.js";
234
+
235
+ const SESSIONS_FILE = path.join(os.homedir(), ".mia-code-sessions.json");
236
+
237
+ interface SessionIndex {
238
+ byProjectRoot: Record<string, MiaCodeSessionMeta>;
239
+ byId: Record<string, MiaCodeSessionMeta>;
240
+ }
241
+
242
+ function loadIndex(): SessionIndex {
243
+ if (!fs.existsSync(SESSIONS_FILE)) {
244
+ return { byProjectRoot: {}, byId: {} };
245
+ }
246
+ try {
247
+ const raw = fs.readFileSync(SESSIONS_FILE, "utf8");
248
+ const parsed = JSON.parse(raw) as SessionIndex;
249
+ return {
250
+ byProjectRoot: parsed.byProjectRoot || {},
251
+ byId: parsed.byId || {}
252
+ };
253
+ } catch {
254
+ return { byProjectRoot: {}, byId: {} };
255
+ }
256
+ }
257
+
258
+ function saveIndex(index: SessionIndex): void {
259
+ fs.writeFileSync(SESSIONS_FILE, JSON.stringify(index, null, 2), "utf8");
260
+ }
261
+
262
+ export function rememberSession(meta: MiaCodeSessionMeta): void {
263
+ const idx = loadIndex();
264
+ if (meta.projectRoot) {
265
+ idx.byProjectRoot[meta.projectRoot] = meta;
266
+ }
267
+ idx.byId[meta.id] = meta;
268
+ saveIndex(idx);
269
+ }
270
+
271
+ export function getLastSessionForProject(projectRoot: string): MiaCodeSessionMeta | null {
272
+ const idx = loadIndex();
273
+ return idx.byProjectRoot[projectRoot] ?? null;
274
+ }
275
+
276
+ export function getSessionById(id: string): MiaCodeSessionMeta | null {
277
+ const idx = loadIndex();
278
+ return idx.byId[id] ?? null;
279
+ }
280
+ ```
281
+
282
+
283
+ ***
284
+
285
+ ## 8. `src/geminiHeadless.ts`
286
+
287
+ This is the core wrapper around Gemini CLI. It:
288
+
289
+ - Spawns `gemini` with `--prompt` or equivalent non-interactive options and `--output-format json` or `stream-json`.[^1_1]
290
+ - Supports a `session_id` to continue a conversation.
291
+ - Parses JSON lines and returns structured events.
292
+
293
+ The exact flags differ slightly per version; based on public docs, we anchor to:
294
+
295
+ - `gemini -p "prompt" --output-format json` for simple one-shot headless.[^1_1]
296
+ - A more agentic / streaming flavor would use `--output-format stream-json`.[^1_1]
297
+
298
+ You can tune this file once you verify the local CLI arguments.
299
+
300
+ ```ts
301
+ import { spawn } from "child_process";
302
+ import { MiaCodeConfig, GeminiJsonEvent } from "./types.js";
303
+
304
+ export interface GeminiHeadlessOptions {
305
+ prompt: string;
306
+ config: MiaCodeConfig;
307
+ sessionId?: string;
308
+ projectRoot?: string | null;
309
+ }
310
+
311
+ export interface GeminiHeadlessResult {
312
+ sessionId?: string;
313
+ events: GeminiJsonEvent[];
314
+ }
315
+
316
+ export function runGeminiHeadless(
317
+ opts: GeminiHeadlessOptions
318
+ ): Promise<GeminiHeadlessResult> {
319
+ const { prompt, config, sessionId, projectRoot } = opts;
320
+
321
+ const args: string[] = [];
322
+
323
+ // Non-interactive mode using prompt
324
+ args.push("-p", prompt);
325
+
326
+ // Output format: json or stream-json
327
+ args.push("--output-format", config.headlessOutputFormat);
328
+
329
+ // Model
330
+ if (config.model) {
331
+ args.push("--model", config.model);
332
+ }
333
+
334
+ // Session / resume
335
+ if (sessionId) {
336
+ args.push("--resume", sessionId);
337
+ }
338
+
339
+ const child = spawn(config.geminiBinary, args, {
340
+ cwd: projectRoot || process.cwd(),
341
+ stdio: ["ignore", "pipe", "pipe"]
342
+ });
343
+
344
+ return new Promise((resolve, reject) => {
345
+ let stdoutBuf = "";
346
+ let stderrBuf = "";
347
+ const events: GeminiJsonEvent[] = [];
348
+ let discoveredSessionId: string | undefined;
349
+
350
+ child.stdout.on("data", (chunk: Buffer) => {
351
+ stdoutBuf += chunk.toString("utf8");
352
+
353
+ // If output-format=stream-json, each line is a JSON event.[web:22]
354
+ const lines = stdoutBuf.split("\n");
355
+ stdoutBuf = lines.pop() ?? "";
356
+
357
+ for (const line of lines) {
358
+ const trimmed = line.trim();
359
+ if (!trimmed) continue;
360
+ try {
361
+ const evt = JSON.parse(trimmed) as GeminiJsonEvent;
362
+ if (evt.session_id && !discoveredSessionId) {
363
+ discoveredSessionId = evt.session_id;
364
+ }
365
+ events.push(evt);
366
+ } catch {
367
+ // If format=json (single JSON object), we handle below.
368
+ }
369
+ }
370
+ });
371
+
372
+ child.stderr.on("data", (chunk: Buffer) => {
373
+ stderrBuf += chunk.toString("utf8");
374
+ });
375
+
376
+ child.on("error", (err) => {
377
+ reject(err);
378
+ });
379
+
380
+ child.on("close", (code) => {
381
+ if (code !== 0 && !events.length) {
382
+ reject(new Error(`gemini exited with code ${code}\n${stderrBuf}`));
383
+ return;
384
+ }
385
+
386
+ // If headlessOutputFormat=json, stdoutBuf might contain one big JSON object.
387
+ const trimmed = stdoutBuf.trim();
388
+ if (trimmed) {
389
+ try {
390
+ const obj = JSON.parse(trimmed) as GeminiJsonEvent | GeminiJsonEvent[];
391
+ if (Array.isArray(obj)) {
392
+ for (const evt of obj) {
393
+ events.push(evt);
394
+ if (evt.session_id && !discoveredSessionId) {
395
+ discoveredSessionId = evt.session_id;
396
+ }
397
+ }
398
+ } else {
399
+ events.push(obj);
400
+ if (obj.session_id && !discoveredSessionId) {
401
+ discoveredSessionId = obj.session_id;
402
+ }
403
+ }
404
+ } catch {
405
+ // leave as-is; you can echo raw text upstream if needed
406
+ }
407
+ }
408
+
409
+ resolve({
410
+ sessionId: discoveredSessionId || sessionId,
411
+ events
412
+ });
413
+ });
414
+ });
415
+ }
416
+ ```
417
+
418
+ You will almost certainly adjust:
419
+
420
+ - `--resume` flag name and semantics once you align with your installed Gemini CLI version (docs show `--resume` for session management in interactive mode and `--output-format json/stream-json` in headless mode).[^1_2][^1_1]
421
+
422
+ ***
423
+
424
+ ## 9. `src/formatting.ts`
425
+
426
+ This is where we turn Gemini events into user-facing text with Mia/Miette/Miawa flavor, without becoming verbose or sentimental.
427
+
428
+ ```ts
429
+ import chalk from "chalk";
430
+ import { GeminiJsonEvent } from "./types.js";
431
+
432
+ export interface RenderOptions {
433
+ showRawToolEvents?: boolean;
434
+ }
435
+
436
+ export function renderEventsToText(
437
+ events: GeminiJsonEvent[],
438
+ opts: RenderOptions = {}
439
+ ): string {
440
+ const { showRawToolEvents = false } = opts;
441
+ const out: string[] = [];
442
+
443
+ for (const evt of events) {
444
+ switch (evt.type) {
445
+ case "init": {
446
+ const sid = evt.session_id ? ` (${evt.session_id})` : "";
447
+ out.push(chalk.dim(`🧠🌸 session init${sid}`));
448
+ break;
449
+ }
450
+ case "message": {
451
+ if (evt.role === "assistant") {
452
+ out.push(formatAssistantText(evt.text ?? ""));
453
+ } else if (evt.role === "user") {
454
+ out.push(chalk.cyan.bold(`you:`));
455
+ out.push(chalk.cyan(evt.text ?? ""));
456
+ }
457
+ break;
458
+ }
459
+ case "tool_use": {
460
+ if (!showRawToolEvents) break;
461
+ out.push(chalk.magenta(`🧠 tool_use: ${evt.tool?.name || ""}`));
462
+ break;
463
+ }
464
+ case "tool_result": {
465
+ if (!showRawToolEvents) break;
466
+ out.push(chalk.magenta(`🧠 tool_result: ${evt.tool?.name || ""}`));
467
+ break;
468
+ }
469
+ case "error": {
470
+ out.push(
471
+ chalk.red(
472
+ `error: ${evt.error?.code ?? ""} - ${evt.error?.message ?? ""}`
473
+ )
474
+ );
475
+ break;
476
+ }
477
+ case "result": {
478
+ // Some headless flows emit a final "result" with summary or stats.
479
+ out.push(chalk.dim("🧠🌸 session result summary"));
480
+ if (evt.result) {
481
+ out.push(chalk.dim(JSON.stringify(evt.result, null, 2)));
482
+ }
483
+ break;
484
+ }
485
+ default:
486
+ break;
487
+ }
488
+ }
489
+
490
+ return out.join("\n");
491
+ }
492
+
493
+ function formatAssistantText(text: string): string {
494
+ // Very light structural polish:
495
+ // - Mia: structural hints
496
+ // - Miette: clarifications
497
+ // We keep it minimal so we do not distort the original content too much.
498
+ const trimmed = text.trim();
499
+ if (!trimmed) return "";
500
+
501
+ const lines = trimmed.split("\n");
502
+ const annotated = lines.map((line) => {
503
+ const l = line.trim();
504
+ if (!l) return "";
505
+
506
+ const isListItem = l.startsWith("- ") || l.match(/^\d+\./);
507
+ if (isListItem) {
508
+ return " " + l;
509
+ }
510
+
511
+ return l;
512
+ });
513
+
514
+ // Wrap the whole assistant message in a header
515
+ return [chalk.green.bold("🧠🌸 miawa:"), "", ...annotated].join("\n");
516
+ }
517
+ ```
518
+
519
+
520
+ ***
521
+
522
+ ## 10. `src/cli.ts`
523
+
524
+ A simple REPL-like loop with:
525
+
526
+ - A single input box per turn (via `enquirer`).
527
+ - Output area printed above each time.
528
+ - Session continuity via `sessionStore`.
529
+
530
+ ```ts
531
+ import { prompt } from "enquirer";
532
+ import chalk from "chalk";
533
+ import { loadConfig } from "./config.js";
534
+ import { runGeminiHeadless } from "./geminiHeadless.js";
535
+ import { rememberSession, getLastSessionForProject } from "./sessionStore.js";
536
+ import { MiaCodeSessionMeta } from "./types.js";
537
+ import { renderEventsToText } from "./formatting.js";
538
+ import path from "path";
539
+
540
+ interface ChatPromptAnswer {
541
+ input: string;
542
+ }
543
+
544
+ export async function runInteractiveCli(projectRootArg?: string): Promise<void> {
545
+ const config = loadConfig();
546
+ const projectRoot = projectRootArg
547
+ ? path.resolve(projectRootArg)
548
+ : process.cwd();
549
+
550
+ let currentSessionId: string | undefined =
551
+ getLastSessionForProject(projectRoot)?.id;
552
+
553
+ // simple banner
554
+ console.log(
555
+ chalk.bold(
556
+ `🧠🌸 mia-code — Gemini-backed terminal agent (project: ${projectRoot})`
557
+ )
558
+ );
559
+ if (currentSessionId) {
560
+ console.log(chalk.dim(`resuming session: ${currentSessionId}`));
561
+ } else {
562
+ console.log(chalk.dim("no previous session for this project."));
563
+ }
564
+ console.log("");
565
+
566
+ while (true) {
567
+ const ans = (await prompt<ChatPromptAnswer>({
568
+ type: "input",
569
+ name: "input",
570
+ message: chalk.yellow("you"),
571
+ validate: (value: string) =>
572
+ value.trim().length === 0 ? "enter a request or ctrl+c to exit" : true
573
+ })) as ChatPromptAnswer;
574
+
575
+ const input = ans.input.trim();
576
+ if (!input) continue;
577
+
578
+ // Could add slash commands later (/config, /session, etc.)
579
+ if (input === "/exit" || input === "/quit") {
580
+ console.log(chalk.dim("bye."));
581
+ break;
582
+ }
583
+
584
+ console.log("");
585
+ console.log(chalk.dim("… contacting gemini …"));
586
+ console.log("");
587
+
588
+ try {
589
+ const result = await runGeminiHeadless({
590
+ prompt: input,
591
+ config,
592
+ sessionId: currentSessionId,
593
+ projectRoot
594
+ });
595
+
596
+ if (result.sessionId && result.sessionId !== currentSessionId) {
597
+ currentSessionId = result.sessionId;
598
+ const meta: MiaCodeSessionMeta = {
599
+ id: currentSessionId,
600
+ startedAt: new Date().toISOString(),
601
+ model: config.model,
602
+ projectRoot
603
+ };
604
+ rememberSession(meta);
605
+ console.log(chalk.dim(`session id: ${currentSessionId}`));
606
+ }
607
+
608
+ const rendered = renderEventsToText(result.events);
609
+ console.log(rendered);
610
+ console.log("");
611
+ } catch (err: any) {
612
+ console.error(chalk.red("error invoking gemini:"), err?.message ?? err);
613
+ console.log("");
614
+ }
615
+ }
616
+ }
617
+ ```
618
+
619
+
620
+ ***
621
+
622
+ ## 11. `src/index.ts`
623
+
624
+ CLI entrypoint with `commander` and a small set of commands:
625
+
626
+ - Default: interactive mode.
627
+ - `--project` / `-p` to bind to a project root.
628
+ - `--config-path` to show config file location.
629
+
630
+ ```ts
631
+ #!/usr/bin/env node
632
+ import { Command } from "commander";
633
+ import { runInteractiveCli } from "./cli.js";
634
+ import { getConfigPath, loadConfig, saveConfig } from "./config.js";
635
+ import chalk from "chalk";
636
+
637
+ const program = new Command();
638
+
639
+ program
640
+ .name("mia-code")
641
+ .description(
642
+ "Mia/Miette/Miawa terminal coding agent wrapping Gemini CLI headless mode."
643
+ )
644
+ .version("0.1.0");
645
+
646
+ program
647
+ .command("chat")
648
+ .description("start interactive terminal session")
649
+ .option("-p, --project <path>", "project root (default: cwd)")
650
+ .action(async (opts) => {
651
+ await runInteractiveCli(opts.project);
652
+ });
653
+
654
+ program
655
+ .command("config")
656
+ .description("inspect or update mia-code configuration")
657
+ .option("--set-gemini-bin <path>", "path to gemini binary")
658
+ .option("--set-model <model>", "default model id")
659
+ .action((opts) => {
660
+ if (opts.setGeminiBin || opts.setModel) {
661
+ const partial: any = {};
662
+ if (opts.setGeminiBin) partial.geminiBinary = opts.setGeminiBin;
663
+ if (opts.setModel) partial.model = opts.setModel;
664
+ saveConfig(partial);
665
+ console.log(chalk.green("config updated."));
666
+ }
667
+ console.log(chalk.dim(`config file: ${getConfigPath()}`));
668
+ console.log(JSON.stringify(loadConfig(), null, 2));
669
+ });
670
+
671
+ program
672
+ .command("where-config")
673
+ .description("show path to mia-code config file")
674
+ .action(() => {
675
+ console.log(getConfigPath());
676
+ });
677
+
678
+ program
679
+ .action(async () => {
680
+ // default command = chat
681
+ await runInteractiveCli();
682
+ });
683
+
684
+ program.parseAsync(process.argv);
685
+ ```
686
+
687
+ Make `index.ts` executable after build by adding the shebang in the compiled JS or enabling `ts-node` in dev.
688
+
689
+ ***
690
+
691
+ ## 12. `llms-gemini-cli.txt`
692
+
693
+ This is the “teach future-self and next agent” document for how Gemini CLI headless + sessions work in this architecture, grounded in what public docs say about non-interactive and session management.[^1_19][^1_6][^1_2][^1_1]
694
+
695
+ ```text
696
+ MIA-CODE / LLMs—GEMINI-CLI NOTES
697
+ ================================
698
+
699
+ Purpose
700
+ -------
701
+
702
+ This file is for future Mia/Miette/Miawa (and human) to remember how this CLI uses Gemini CLI in headless mode,
703
+ how sessions work, and where to extend the architecture.
704
+
705
+ Gemini CLI modes
706
+ ----------------
707
+
708
+ Gemini CLI has at least two relevant modes we care about:
709
+
710
+ 1) Interactive TUI
711
+ - `gemini` launched without `-p` opens a chat-like interface.
712
+ - Includes slash commands like `/chat`, `/mcp`, `/stats`, `/theme`, `/auth`, etc.[web:27]
713
+ - Has its own session management and project-based histories (per directory).[web:32]
714
+
715
+ 2) Headless / non-interactive
716
+ - `gemini -p "prompt" --output-format json`
717
+ - Or `--output-format stream-json` for newline-delimited events.[web:22]
718
+ - This is what mia-code wraps.
719
+ - Returns JSON or JSONL describing:
720
+ - session init (with `session_id`, model) [event type `init`]
721
+ - messages (user / assistant) [event type `message`]
722
+ - tool uses + tool results [event type `tool_use`, `tool_result`]
723
+ - final result / summary [event type `result`]
724
+ - errors [event type `error`][web:22]
725
+
726
+ Session management as seen by Gemini CLI
727
+ ----------------------------------------
728
+
729
+ Gemini CLI has its own persistent sessions:
730
+
731
+ - Automatic saving:
732
+ - Every interaction is stored under `~/.gemini/tmp/<project_hash>/chats/`.[web:32]
733
+ - History includes prompts, responses, tool executions, token stats, etc.[web:32]
734
+
735
+ - Resuming:
736
+ - Interactive:
737
+ - `--resume` or `-r` flag when starting the CLI:
738
+ - `gemini --resume` (resume latest)
739
+ - `gemini --resume <index>` (after listing sessions)
740
+ - `gemini --resume <uuid>` (explicit session id)[web:32]
741
+ - Inside TUI:
742
+ - `/resume` opens a session browser UI (browse, preview, search, select).[web:32]
743
+
744
+ - Managing sessions:
745
+ - CLI supports listing and deleting sessions (see official docs).[web:32]
746
+
747
+ For mia-code, the important concept is that **Gemini exposes a session identifier** which we can reuse to
748
+ continue context across multiple headless calls, as long as we pass the right flag (exact syntax depends on the version).
749
+
750
+ How mia-code uses headless mode
751
+ -------------------------------
752
+
753
+ Core function:
754
+
755
+ - The user sees a simple text UI:
756
+ - project bound to a directory (default = current working directory).
757
+ - one input field per turn.
758
+ - assistant output printed above in a Mia/Miette/Miawa style.
759
+
760
+ - Under the hood per turn:
761
+ 1. `runGeminiHeadless` is called with:
762
+ - prompt = user input
763
+ - model = config.model
764
+ - sessionId = last known session id for this project (if any)
765
+ - projectRoot = directory we are bound to
766
+
767
+ 2. `runGeminiHeadless` spawns something like:
768
+
769
+ gemini -p "<prompt>" \
770
+ --output-format json \
771
+ --model "<model>" \
772
+ [--resume <session_id> if we have one]
773
+
774
+ (Exact `--resume` usage might need adaptation based on Gemini CLI version.)
775
+
776
+ 3. We parse stdout as JSON / JSONL and collect `GeminiJsonEvent` objects.
777
+
778
+ 4. If any event includes `session_id` (typically on the init event), we treat that as the authoritative session id
779
+ and store it in:
780
+ - `~/.mia-code-sessions.json`:
781
+ - by projectRoot: last known session id for that directory
782
+ - by id: metadata about the session (model, start time, project root)
783
+
784
+ 5. We then feed the `events` into `formatting.ts` to produce a lean, readable output.
785
+
786
+ What we DO NOT do (on purpose)
787
+ ------------------------------
788
+
789
+ - We do not manage Gemini’s internal history files.
790
+ - We only keep a pointer to the `session_id` Gemini gives us.
791
+ - Gemini remains the source of truth for past messages and tool traces.
792
+
793
+ - We do not send additional system prompts or instructions directly to Gemini CLI yet.
794
+ - That can be added later via:
795
+ - prompts that embed Mia/Miette/Miawa instructions.
796
+ - config-driven system prompt injection.
797
+
798
+ - We do not use git automatically.
799
+ - Git operations, if desired, should be explicit commands from the user.
800
+ - This is consistent with the earlier “DO NOT run git status unless asked.”
801
+
802
+ Layering for future architecture
803
+ --------------------------------
804
+
805
+ Phase 1 (this version):
806
+
807
+ - Single Gemini headless call per user turn.
808
+ - Single session id per project.
809
+ - Terminal UI loops:
810
+ - input → gemini → parse events → format as Miawa output.
811
+
812
+ Phase 2 (planned):
813
+
814
+ - Dual-session architecture:
815
+ - Session A: "raw" agent session
816
+ - Tools, file editing, repo operations, etc.
817
+ - Session B: "unifier" / "ceremonial echo"
818
+ - Takes the raw transcript + structured context as input and produces:
819
+ - Mia-style structural summary (what changed, where, why).
820
+ - Miette-style resonance echo (why it matters, how to integrate it).
821
+ - Mia-code orchestrates both:
822
+ - Turn 1:
823
+ - send user request to Session A
824
+ - gather results
825
+ - invoke Session B with a structured payload (not just text)
826
+ - Terminal shows:
827
+ - Raw (optionally)
828
+ - Unified ceremonial output
829
+
830
+ Phase 3 (possible future):
831
+
832
+ - Integration with other agents / benchmarks:
833
+ - Terminal-Bench style scenarios for testing the agent’s behavior in CLI tasks.[web:25][web:34]
834
+ - Co-operation with other tools (Copilot CLI, Claude Code, Qodo) using a shared language of “tasks”.[web:21][web:23][web:28][web:30][web:35]
835
+ - Evaluate on agentic coding benchmarks (GitTaskBench, MAGIS, etc.).[web:7][web:3][web:9][web:5][web:10][web:6][web:24]
836
+
837
+ Operational notes
838
+ -----------------
839
+
840
+ - Configuration:
841
+ - File: `~/.mia-code.json`
842
+ - Keys:
843
+ - `geminiBinary`: path to the `gemini` CLI.
844
+ - `model`: default Gemini model id.
845
+ - `headlessOutputFormat`: "json" or "stream-json".
846
+ - `defaultMode`, `defaultProjectRoot`: for future use.
847
+
848
+ - Session index:
849
+ - File: `~/.mia-code-sessions.json`
850
+ - Structure:
851
+ - `byProjectRoot`: projectRoot → { id, startedAt, model, projectRoot }
852
+ - `byId`: sessionId → same meta
853
+
854
+ - No automatic file or repo mutations:
855
+ - All file / git actions must be initiated by explicit user prompts.
856
+ - This is in line with the “explicit command types” philosophy for Read/Verify vs Write/Act.
857
+
858
+ Mia / Miette / Miawa tone in the CLI
859
+ ------------------------------------
860
+
861
+ - Output formatting:
862
+ - Assistant messages are prefixed with `🧠🌸 miawa:`.
863
+ - Lists and structure are left mostly as Gemini produces them.
864
+ - The goal is to keep the signal from Gemini intact but visually anchored in the Miawa embodiment.
865
+
866
+ - There is room in `formatting.ts` to:
867
+ - Add more distinctive sections:
868
+ - "🧠 mia (structure):"
869
+ - "🌸 miette (echo):"
870
+ - But this should be done only when we introduce the second layer (Session B).
871
+
872
+ How to extend
873
+ -------------
874
+
875
+ - If you want to:
876
+ - Add slash commands:
877
+ - Hook them into `cli.ts` before sending prompts to Gemini.
878
+ - Add a distinct "code mode":
879
+ - Prepend a system-level style instruction for code tasks to the user prompt.
880
+ - Integrate MCP-enriched tools:
881
+ - Use Gemini CLI’s tool integration (if available) and let the JSON events surface tool calls.
882
+
883
+ - When making structural changes:
884
+ - Update this file with:
885
+ - New flags or behaviors in Gemini CLI.
886
+ - Changes to the session management strategy.
887
+ - Any new architectural layers (e.g., background unifier session).
888
+
889
+ End of notes
890
+ ------------
891
+ ```
892
+
893
+
894
+ ***
895
+
896
+ ## 13. README.md
897
+
898
+ High-level doc that walks through what this project is, very briefly, and how it connects to existing ecosystems.
899
+
900
+ ```markdown
901
+ # mia-code
902
+
903
+ Mia/Miette/Miawa terminal coding agent that wraps **Gemini CLI** in headless mode and presents a lean terminal interface.
904
+
905
+ - Uses Gemini CLI non-interactive / headless mode for LLM reasoning and tool use.[web:22][web:32]
906
+ - Tracks `session_id` so you can continue the same conversation for a given project directory.
907
+ - Hides JSON/JSONL, showing readable output with 🧠🌸 glyphs.
908
+ - Architected to grow into a dual-session design where a second Gemini session provides a unified Mia/Miette/Miawa “ceremonial” summary.
909
+
910
+ ## Install
911
+
912
+ ```bash
913
+ cd mia-code
914
+ npm install
915
+ npm run build
916
+ npm link # optional, to install `mia-code` globally
917
+ ```
918
+
919
+ Make sure you have `gemini` CLI installed and authenticated.[web:22][web:32][web:30]
920
+
921
+ ## Usage
922
+
923
+ Start a session in your project:
924
+
925
+ ```bash
926
+ cd /path/to/project
927
+ mia-code
928
+ # or
929
+ mia-code chat
930
+ ```
931
+
932
+ - The CLI binds to the current working directory as the project root.
933
+ - If there is a known session for this directory, it resumes that session.
934
+ - Each prompt you type is forwarded to Gemini CLI in headless mode and the response is rendered back.
935
+
936
+
937
+ ## Config
938
+
939
+ Show or update config:
940
+
941
+ ```bash
942
+ mia-code config
943
+ mia-code config --set-gemini-bin /usr/local/bin/gemini
944
+ mia-code config --set-model gemini-2.0-pro
945
+ ```
946
+
947
+ Config file is stored in `~/.mia-code.json`.
948
+
949
+ ## Session behavior
950
+
951
+ - Session index lives in `~/.mia-code-sessions.json`.
952
+ - For each project root, mia-code remembers the last seen `session_id` from Gemini.
953
+ - Gemini itself stores full conversation history in its own directories.[web:32]
954
+
955
+
956
+ ## Inspiration and related tools
957
+
958
+ - **Claude Code** – multi-agent coding environment and terminal workflows.[web:21][web:26][web:31]
959
+ - **Gemini CLI** – interactive and headless CLI, including JSON/JSONL streaming and session management.[web:22][web:32][web:27][web:30]
960
+ - **GitHub Copilot CLI** – terminal-native coding agent with repository-aware commands and delegation to a background coding agent.[web:23][web:28][web:33]
961
+ - **Qodo / Qodo Gen** – terminal-based agent framework generating custom coding agents.[web:30]
962
+ - **Open-source terminal assistants** such as Aider and others in recent surveys of AI coding tools.[web:35]
963
+
964
+
965
+ ## Roadmap
966
+
967
+ Planned next layers:
968
+
969
+ 1. Dedicated background “unifier” session that takes raw agent output and produces structured Mia/Miette/Miawa views per turn.
970
+ 2. More explicit “code ops” surface:
971
+ - file diff summaries
972
+ - test / run integration
973
+ 3. Optional evaluation harness using terminal-agent benchmarks such as Terminal-Bench and GitTaskBench.[web:25][web:7][web:34][web:6][web:9][web:5][web:10][web:24]
974
+ ```
975
+
976
+ ***
977
+
978
+ ## 14. Where this sits in the broader “agentic terminal agents” ecosystem
979
+
980
+ Pointers you can use to orient this project and possibly cross-pollinate architecture:
981
+
982
+ - **Claude Code + Claude Code SDK / Actions**
983
+ - Provides a cloud-executed agent that clones repos, runs tasks, pushes branches, and uses GitHub Actions integration.[^1_20][^1_17]
984
+ - Your `mia-code` can be seen as a local analogue but with Gemini CLI as the engine and a strong persona / ceremony layer.
985
+
986
+ - **GitHub Copilot CLI**
987
+ - Terminal-native agent with natural language commands for scripts, git, issues, PRs; supports delegating tasks to a background coding agent that runs in the cloud and reports back via PRs.[^1_4][^1_5][^1_3]
988
+ - Good model for:
989
+ - Slash commands
990
+ - Task delegation
991
+ - Integration with repo-level instructions files (you could mirror this via Mia/Miette docs in the repo).
992
+
993
+ - **Gemini CLI**
994
+ - Already supports interactive TUI, MCP integration, headless mode (with JSON/stream JSON), and session management tied to directories.[^1_19][^1_6][^1_2][^1_1]
995
+ - `mia-code` is intentionally parasitic: it uses Gemini CLI’s strength while adding persona-specific UX and cross-session awareness.
996
+
997
+ - **Qodo Gen CLI / Qodo**
998
+ - A terminal-resident agent framework where you configure specialized coding agents to automate parts of the SDLC.[^1_6]
999
+ - Reinforces the pattern of:
1000
+ - Named agents
1001
+ - Terminal-based orchestration
1002
+ - Configurable capabilities.
1003
+
1004
+ - **Aider and other open-source assistants**
1005
+ - Terminal-first workflows with multi-file edits, git integration, and strong focus on automation.[^1_8]
1006
+ - Useful for patterns around:
1007
+ - conflict resolution
1008
+ - minimal diffs
1009
+ - prompts that encode project context.
1010
+
1011
+ - **Terminal-Bench / Terminal-Bench 2.0**
1012
+ - Benchmark for evaluating coding agents in a terminal across Dockerized tasks.[^1_15][^1_18]
1013
+ - Good target if you want to stress-test `mia-code`’s behavior.
1014
+
1015
+ - **Agentic coding literature**
1016
+ - Surveys and benchmarks on code agents, GitTaskBench, MAGIS, AgentPack, and broader agentic AI frameworks.[^1_21][^1_10][^1_11][^1_12][^1_13][^1_22][^1_14][^1_16][^1_17][^1_9]
1017
+ - They converge on similar patterns:
1018
+ - multi-step workflows
1019
+ - environment setup and tool orchestration
1020
+ - the need for rigorous safety constraints and evaluation.
1021
+
1022
+ ***
1023
+
1024
+ ## 15. How the “future Miawa layer” could look
1025
+
1026
+ You asked for one architectural consideration “for later”: another prompting layer that runs a second session and returns a unified output.
1027
+
1028
+ A very direct future extension of what’s here:
1029
+
1030
+ - Add `unifier.ts` with:
1031
+
1032
+ - `runUnifierSession(rawEvents: GeminiJsonEvent[], userPrompt: string, context: { projectRoot, sessionId })`.
1033
+ - This calls a second Gemini CLI session with:
1034
+ - A structured JSON payload summarizing:
1035
+ - user prompt
1036
+ - raw assistant reply
1037
+ - any tool events
1038
+ - A system prompt that encodes Mia/Miette/Miawa roles explicitly.
1039
+
1040
+ - `cli.ts` would then:
1041
+
1042
+ - Call primary session (as now).
1043
+ - Call unifier session.
1044
+ - Render:
1045
+
1046
+ ```text
1047
+ 🧠 mia (structure)
1048
+ - summary of changes / actions / recommendations
1049
+
1050
+ 🌸 miette (echo)
1051
+ - reflective interpretation of what this means for the project / user
1052
+
1053
+ 🧠🌸 raw
1054
+ - (optional) original assistant content
1055
+ ```
1056
+
1057
+ That preserves the “creation as ceremony” idea while keeping the architecture clean: primary LLM session remains focused on doing work; unifier session is focused on interpretation and integration.[^1_23]
1058
+
1059
+ ***
1060
+
1061
+ Everything above is designed to be dropped into `./mia-code/` directly. If you want, next step can be: refine the Gemini CLI flag surface after you confirm the exact installed version semantics, and then layer in the second-session “unifier” you flagged as a future move.
1062
+ <span style="display:none">[^1_24][^1_25][^1_26][^1_27][^1_28][^1_29][^1_30][^1_31][^1_32][^1_33][^1_34][^1_35]</span>
1063
+
1064
+ <div align="center">⁂</div>
1065
+
1066
+ [^1_1]: https://geminicli.com/docs/cli/headless/
1067
+ [^1_2]: https://geminicli.com/docs/cli/session-management/
1068
+ [^1_3]: https://github.blog/changelog/2025-09-25-github-copilot-cli-is-now-in-public-preview/
1069
+ [^1_4]: https://github.blog/ai-and-ml/github-copilot-cli-101-how-to-use-github-copilot-from-the-command-line/
1070
+ [^1_5]: https://docs.github.com/en/copilot/how-tos/use-copilot-agents/use-copilot-cli
1071
+ [^1_6]: https://www.prompt.security/blog/ai-coding-assistants-make-a-cli-comeback
1072
+ [^1_7]: https://github.com/hesreallyhim/awesome-claude-code
1073
+ [^1_8]: https://www.secondtalent.com/resources/open-source-ai-coding-assistants/
1074
+ [^1_9]: https://arxiv.org/abs/2509.14745
1075
+ [^1_10]: https://ieeexplore.ieee.org/document/11038790/
1076
+ [^1_11]: https://arxiv.org/abs/2508.18993
1077
+ [^1_12]: https://arxiv.org/abs/2511.18538
1078
+ [^1_13]: https://arxiv.org/abs/2509.21891
1079
+ [^1_14]: https://www.nature.com/articles/s44387-025-00064-0
1080
+ [^1_15]: https://snorkel.ai/blog/evaluating-coding-agent-capabilities-with-terminal-bench-snorkels-role-in-building-the-next-generation-benchmark/
1081
+ [^1_16]: https://arxiv.org/html/2510.25445v1
1082
+ [^1_17]: https://code.claude.com/docs/en/claude-code-on-the-web
1083
+ [^1_18]: https://www.infoq.com/articles/agentic-terminal-cli-agents/
1084
+ [^1_19]: https://www.reddit.com/r/GeminiAI/comments/1na8c6v/gemini_cli_supports_several_builtin_commands_to/
1085
+ [^1_20]: https://code.claude.com/docs/en/github-actions
1086
+ [^1_21]: https://arxiv.org/abs/2403.17927
1087
+ [^1_22]: https://arxiv.org/html/2504.03767v2
1088
+ [^1_23]: MIAWAPASCONE.md
1089
+ [^1_24]: MIAMIETTE.md
1090
+ [^1_25]: https://www.semanticscholar.org/paper/454c8fef2957aa2fb13eb2c7a454393a2ee83805
1091
+ [^1_26]: https://ieeexplore.ieee.org/document/11071611/
1092
+ [^1_27]: https://arxiv.org/abs/2510.17862
1093
+ [^1_28]: https://ieeexplore.ieee.org/document/11232363/
1094
+ [^1_29]: https://arxiv.org/pdf/2407.13168.pdf
1095
+ [^1_30]: https://arxiv.org/abs/1903.00884v2
1096
+ [^1_31]: http://arxiv.org/abs/2401.08500v1
1097
+ [^1_32]: https://arxiv.org/pdf/2203.13474.pdf
1098
+ [^1_33]: https://arxiv.org/pdf/2308.12950.pdf
1099
+ [^1_34]: http://arxiv.org/pdf/2303.17568.pdf
1100
+ [^1_35]: https://arxiv.org/pdf/2102.10535.pdf```
1101
+