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.
- package/.miette/260321.md +1 -0
- package/.miette/260323.md +9 -0
- package/.miette/260331.md +2 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--d3417f2c-df12-4f0f-8a1b-d88e7968f822/d3417f2c-df12-4f0f-8a1b-d88e7968f822.md +63 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--e6c3fc5d-4a70-4523-ba7d-a3250da4c235/e6c3fc5d-4a70-4523-ba7d-a3250da4c235.md +72 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/2604020008--efeb00a2-b17a-4d32-b1f0-b90c37a8d24e/efeb00a2-b17a-4d32-b1f0-b90c37a8d24e.md +62 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/83a2d7f9-24a5-4cf4-98d5-036c82f872e8.json +302 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/83a2d7f9-24a5-4cf4-98d5-036c82f872e8.md +149 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/AGENTS.md +31 -0
- package/.pde/2604011511--83a2d7f9-24a5-4cf4-98d5-036c82f872e8/meta-decomposition-3-children.md +67 -0
- package/.pde/2604040129--61f9dd4d-7aa6-45e6-a58b-e480b1aa6737/61f9dd4d-7aa6-45e6-a58b-e480b1aa6737--from-mia-openclaw-workspace.md +125 -0
- package/.pde/2604040129--61f9dd4d-7aa6-45e6-a58b-e480b1aa6737/STATUS.md +1 -0
- package/.pde/4f02ba94-9f52-422e-9389-b16f9b37f358.json +177 -0
- package/.pde/4f02ba94-9f52-422e-9389-b16f9b37f358.md +77 -0
- package/.pde/6ad9244d-5340-490f-b76c-c86728b9de52.json +222 -0
- package/.pde/6ad9244d-5340-490f-b76c-c86728b9de52.md +99 -0
- package/.pde/8b566792-ed15-4606-96f9-2b6f593d7e6b.json +111 -0
- package/.pde/8b566792-ed15-4606-96f9-2b6f593d7e6b.md +67 -0
- package/.pde/c7f1e74b-05a5-40e2-9f01-4cc48d2528f7.json +349 -0
- package/.pde/c7f1e74b-05a5-40e2-9f01-4cc48d2528f7.md +147 -0
- package/.pde/dfc00a78-1da0-4c09-8a16-c6982644051b.json +118 -0
- package/.pde/dfc00a78-1da0-4c09-8a16-c6982644051b.md +64 -0
- package/GUILLAUME.md +8 -0
- package/KINSHIP.md +9 -0
- package/MIA_CODE_ARCHITECTURE_REPORT.md +718 -0
- package/contextual_research/260119-MIA-CODE--98090899-8aff-4e11-9dc3-8b99466d1.md +1101 -0
- package/contextual_research/MIA.md +38 -0
- package/contextual_research/MIAWAPASCONE.md +59 -0
- package/contextual_research/MIETTE.md +38 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/2504.00218v2.pdf +7483 -12
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/2505.00212v3.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/CONTENT.md +1014 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/DESIGN.gemini.md +242 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/INDEX.md +45 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2504.00218v2.md +2025 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2504.00218v2.pdf +7483 -12
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2505.00212v3.md +1755 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/2505.00212v3.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_12_decomposed_prompting.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_19_hugginggpt_planning.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_1_coordination_challenges.md +766 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_1_coordination_challenges.pdf +3431 -4
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_28_guardrails_multi_agent.md +260 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_28_guardrails_multi_agent.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_2_navigating_complexity.md +558 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_2_navigating_complexity.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_34_hierarchical_multi_agent.pdf +0 -0
- package/contextual_research/PDE-generalization--caefee82-efb1-4dbb-8733-691b01581464--260130/sources/footnote_1_5_open_intent_extraction.pdf +0 -0
- package/contextual_research/PODCAST.md +109 -0
- package/contextual_research/langchain-principles-roadmap.md +157 -0
- package/contextual_research/persona-to-narrative-character-inquiry_260201.md +50 -0
- package/dist/cli.js +35 -11
- package/dist/geminiHeadless.js +8 -2
- package/dist/index.js +2 -1
- package/dist/mcp/miaco-server.js +10 -1
- package/dist/mcp/miatel-server.js +10 -1
- package/dist/mcp/miawa-server.js +10 -1
- package/dist/mcp/utils.d.ts +6 -1
- package/dist/mcp/utils.js +24 -3
- package/dist/sessionStore.d.ts +8 -2
- package/dist/sessionStore.js +39 -3
- package/dist/types.d.ts +1 -0
- package/miaco/README.md +124 -0
- package/miaco/dist/commands/chart.d.ts +6 -0
- package/miaco/dist/commands/chart.d.ts.map +1 -0
- package/miaco/dist/commands/chart.js +222 -0
- package/miaco/dist/commands/chart.js.map +1 -0
- package/miaco/dist/commands/decompose.d.ts +6 -0
- package/miaco/dist/commands/decompose.d.ts.map +1 -0
- package/miaco/dist/commands/decompose.js +98 -0
- package/miaco/dist/commands/decompose.js.map +1 -0
- package/miaco/dist/commands/schema.d.ts +6 -0
- package/miaco/dist/commands/schema.d.ts.map +1 -0
- package/miaco/dist/commands/schema.js +66 -0
- package/miaco/dist/commands/schema.js.map +1 -0
- package/miaco/dist/commands/stc.d.ts +11 -0
- package/miaco/dist/commands/stc.d.ts.map +1 -0
- package/miaco/dist/commands/stc.js +590 -0
- package/miaco/dist/commands/stc.js.map +1 -0
- package/miaco/dist/commands/trace.d.ts +6 -0
- package/miaco/dist/commands/trace.d.ts.map +1 -0
- package/miaco/dist/commands/trace.js +83 -0
- package/miaco/dist/commands/trace.js.map +1 -0
- package/miaco/dist/commands/validate.d.ts +6 -0
- package/miaco/dist/commands/validate.d.ts.map +1 -0
- package/miaco/dist/commands/validate.js +58 -0
- package/miaco/dist/commands/validate.js.map +1 -0
- package/miaco/dist/decompose.d.ts +93 -0
- package/miaco/dist/decompose.d.ts.map +1 -0
- package/miaco/dist/decompose.js +562 -0
- package/miaco/dist/decompose.js.map +1 -0
- package/miaco/dist/index.d.ts +18 -0
- package/miaco/dist/index.d.ts.map +1 -0
- package/miaco/dist/index.js +83 -0
- package/miaco/dist/index.js.map +1 -0
- package/miaco/dist/storage.d.ts +60 -0
- package/miaco/dist/storage.d.ts.map +1 -0
- package/miaco/dist/storage.js +100 -0
- package/miaco/dist/storage.js.map +1 -0
- package/miaco/package-lock.json +4103 -0
- package/miaco/package.json +40 -0
- package/miaco/tsconfig.json +18 -0
- package/miaco/version-patch-commit-and-publish.sh +1 -0
- package/miatel/MISSION_251231.md +3 -0
- package/miatel/README.md +107 -0
- package/miatel/dist/commands/analyze.d.ts +6 -0
- package/miatel/dist/commands/analyze.d.ts.map +1 -0
- package/miatel/dist/commands/analyze.js +100 -0
- package/miatel/dist/commands/analyze.js.map +1 -0
- package/miatel/dist/commands/arc.d.ts +6 -0
- package/miatel/dist/commands/arc.d.ts.map +1 -0
- package/miatel/dist/commands/arc.js +71 -0
- package/miatel/dist/commands/arc.js.map +1 -0
- package/miatel/dist/commands/beat.d.ts +6 -0
- package/miatel/dist/commands/beat.d.ts.map +1 -0
- package/miatel/dist/commands/beat.js +165 -0
- package/miatel/dist/commands/beat.js.map +1 -0
- package/miatel/dist/commands/theme.d.ts +6 -0
- package/miatel/dist/commands/theme.d.ts.map +1 -0
- package/miatel/dist/commands/theme.js +54 -0
- package/miatel/dist/commands/theme.js.map +1 -0
- package/miatel/dist/index.d.ts +18 -0
- package/miatel/dist/index.d.ts.map +1 -0
- package/miatel/dist/index.js +80 -0
- package/miatel/dist/index.js.map +1 -0
- package/miatel/dist/storage.d.ts +55 -0
- package/miatel/dist/storage.d.ts.map +1 -0
- package/miatel/dist/storage.js +100 -0
- package/miatel/dist/storage.js.map +1 -0
- package/miatel/package-lock.json +4103 -0
- package/miatel/package.json +35 -0
- package/miatel/src/commands/analyze.ts +109 -0
- package/miatel/src/commands/arc.ts +78 -0
- package/miatel/src/commands/beat.ts +176 -0
- package/miatel/src/commands/theme.ts +60 -0
- package/miatel/src/index.ts +94 -0
- package/miatel/src/storage.ts +156 -0
- package/miatel/tsconfig.json +18 -0
- package/miawa/MISSION_251231.md +144 -0
- package/miawa/README.md +133 -0
- package/miawa/dist/commands/beat.d.ts +6 -0
- package/miawa/dist/commands/beat.d.ts.map +1 -0
- package/miawa/dist/commands/beat.js +69 -0
- package/miawa/dist/commands/beat.js.map +1 -0
- package/miawa/dist/commands/ceremony.d.ts +6 -0
- package/miawa/dist/commands/ceremony.d.ts.map +1 -0
- package/miawa/dist/commands/ceremony.js +239 -0
- package/miawa/dist/commands/ceremony.js.map +1 -0
- package/miawa/dist/commands/circle.d.ts +6 -0
- package/miawa/dist/commands/circle.d.ts.map +1 -0
- package/miawa/dist/commands/circle.js +75 -0
- package/miawa/dist/commands/circle.js.map +1 -0
- package/miawa/dist/commands/eva.d.ts +6 -0
- package/miawa/dist/commands/eva.d.ts.map +1 -0
- package/miawa/dist/commands/eva.js +73 -0
- package/miawa/dist/commands/eva.js.map +1 -0
- package/miawa/dist/commands/wound.d.ts +6 -0
- package/miawa/dist/commands/wound.d.ts.map +1 -0
- package/miawa/dist/commands/wound.js +74 -0
- package/miawa/dist/commands/wound.js.map +1 -0
- package/miawa/dist/index.d.ts +19 -0
- package/miawa/dist/index.d.ts.map +1 -0
- package/miawa/dist/index.js +91 -0
- package/miawa/dist/index.js.map +1 -0
- package/miawa/dist/storage.d.ts +73 -0
- package/miawa/dist/storage.d.ts.map +1 -0
- package/miawa/dist/storage.js +100 -0
- package/miawa/dist/storage.js.map +1 -0
- package/miawa/package-lock.json +4103 -0
- package/miawa/package.json +36 -0
- package/miawa/src/commands/beat.ts +74 -0
- package/miawa/src/commands/ceremony.ts +256 -0
- package/miawa/src/commands/circle.ts +83 -0
- package/miawa/src/commands/eva.ts +84 -0
- package/miawa/src/commands/wound.ts +79 -0
- package/miawa/src/index.ts +108 -0
- package/miawa/src/storage.ts +179 -0
- package/miawa/tsconfig.json +18 -0
- package/package.json +7 -5
- package/references/acp/CLAUDE.md +7 -0
- package/references/acp/agent-plan.md +84 -0
- package/references/acp/clients.md +31 -0
- package/references/acp/extensibility.md +137 -0
- package/references/acp/initialization.md +225 -0
- package/references/acp/prompt-turn.md +321 -0
- package/references/acp/proxy-chains.md +562 -0
- package/references/acp/schema.md +3171 -0
- package/references/acp/session-list.md +334 -0
- package/references/acp/session-modes.md +170 -0
- package/references/acp/slash-commands.md +99 -0
- package/references/acp/terminals.md +281 -0
- package/references/acp/tool-calls.md +311 -0
- package/references/acp/typescript.md +29 -0
- package/references/claude/agent-teams.md +399 -0
- package/references/claude/chrome.md +231 -0
- package/references/claude/headless.md +158 -0
- package/references/claude/hooks-guide.md +708 -0
- package/references/claude/output-styles.md +112 -0
- package/references/claude/plugins.md +432 -0
- package/references/claude/skills.md +693 -0
- package/references/claude/sub-agents.md +816 -0
- package/references/copilot/acp/agents.md +32 -0
- package/references/copilot/acp/architecture.md +37 -0
- package/references/copilot/acp/clients.md +31 -0
- package/references/copilot/acp/introduction.md +42 -0
- package/references/copilot/acp/registry.md +339 -0
- package/references/copilot/acp-server.md +117 -0
- package/references/copilot/create-copilot-instructions.md +840 -0
- package/references/langchain/llms.txt +833 -0
- package/references/langchain/python/agents.md +677 -0
- package/references/langchain/python/context-engineering.md +1195 -0
- package/references/langchain/python/human-in-the-loop.md +326 -0
- package/references/langchain/python/long-term-memory.md +168 -0
- package/references/langchain/python/mcp.md +949 -0
- package/references/langchain/python/multi-agents/custom-workflow.md +187 -0
- package/references/langchain/python/multi-agents/handoffs.md +436 -0
- package/references/langchain/python/multi-agents/overview.md +295 -0
- package/references/langchain/python/multi-agents/router.md +150 -0
- package/references/langchain/python/multi-agents/skills.md +92 -0
- package/references/langchain/python/multi-agents/subagents.md +486 -0
- package/references/langchain/python/retrieval.md +320 -0
- package/references/langchain/python/runtime.md +141 -0
- package/references/langchain/python/short-term-memory.md +658 -0
- package/references/langchain/python/structured-output.md +712 -0
- package/references/langfuse/llms.txt +148 -0
- package/references/langgraph/javascript/llms.txt +275 -0
- package/references/skills/home.md +259 -0
- package/references/skills/integrate-skills.md +103 -0
- package/references/skills/specification.md +254 -0
- package/references/skills/what-are-skills.md +74 -0
- package/rispecs/README.md +164 -0
- package/rispecs/_sync_/miadi-code/SPEC.md +313 -0
- package/rispecs/_sync_/miadi-code/STATUS.md +177 -0
- package/rispecs/_sync_/miadi-code/dashboard/SPEC.md +465 -0
- package/rispecs/_sync_/miadi-code/dashboard/STATUS.md +212 -0
- package/rispecs/_sync_/miadi-code/multiline-input/SPEC.md +232 -0
- package/rispecs/_sync_/miadi-code/multiline-input/STATUS.md +108 -0
- package/rispecs/_sync_/miadi-code/pde/SPEC.md +253 -0
- package/rispecs/_sync_/miadi-code/pde/STATUS.md +56 -0
- package/rispecs/_sync_/miadi-code/stc/SPEC.md +397 -0
- package/rispecs/_sync_/miadi-code/stc/STATUS.md +70 -0
- package/rispecs/ava-langstack/inquiry-routing-upgrade.spec.md +119 -0
- package/rispecs/borrowed_from_opencode/001-client-server-architecture.rispec.md +98 -0
- package/rispecs/borrowed_from_opencode/002-event-bus-system.rispec.md +125 -0
- package/rispecs/borrowed_from_opencode/003-instance-state-pattern.rispec.md +136 -0
- package/rispecs/borrowed_from_opencode/004-namespace-module-pattern.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/005-zod-schema-validation.rispec.md +139 -0
- package/rispecs/borrowed_from_opencode/006-named-error-system.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/007-structured-logging.rispec.md +138 -0
- package/rispecs/borrowed_from_opencode/008-lazy-initialization.rispec.md +127 -0
- package/rispecs/borrowed_from_opencode/009-multi-agent-system.rispec.md +97 -0
- package/rispecs/borrowed_from_opencode/010-agent-definition-config.rispec.md +135 -0
- package/rispecs/borrowed_from_opencode/011-agent-permission-rulesets.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/012-agent-prompt-templates.rispec.md +141 -0
- package/rispecs/borrowed_from_opencode/013-agent-generation.rispec.md +142 -0
- package/rispecs/borrowed_from_opencode/014-plan-build-mode-toggle.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/015-subagent-task-delegation.rispec.md +146 -0
- package/rispecs/borrowed_from_opencode/016-agent-model-selection.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/017-compaction-agent.rispec.md +150 -0
- package/rispecs/borrowed_from_opencode/018-session-persistence.rispec.md +125 -0
- package/rispecs/borrowed_from_opencode/019-session-compaction.rispec.md +132 -0
- package/rispecs/borrowed_from_opencode/020-session-forking.rispec.md +134 -0
- package/rispecs/borrowed_from_opencode/021-session-revert-snapshot.rispec.md +135 -0
- package/rispecs/borrowed_from_opencode/022-session-sharing.rispec.md +165 -0
- package/rispecs/borrowed_from_opencode/023-session-summary-diffs.rispec.md +165 -0
- package/rispecs/borrowed_from_opencode/024-child-sessions.rispec.md +164 -0
- package/rispecs/borrowed_from_opencode/025-session-title-generation.rispec.md +162 -0
- package/rispecs/borrowed_from_opencode/026-message-parts-model.rispec.md +201 -0
- package/rispecs/borrowed_from_opencode/027-streaming-message-deltas.rispec.md +212 -0
- package/rispecs/borrowed_from_opencode/028-multi-provider-architecture.rispec.md +184 -0
- package/rispecs/borrowed_from_opencode/029-provider-authentication.rispec.md +225 -0
- package/rispecs/borrowed_from_opencode/030-model-registry.rispec.md +222 -0
- package/rispecs/borrowed_from_opencode/031-cost-tracking.rispec.md +243 -0
- package/rispecs/borrowed_from_opencode/032-provider-transform-pipeline.rispec.md +282 -0
- package/rispecs/borrowed_from_opencode/033-provider-sdk-abstraction.rispec.md +338 -0
- package/rispecs/borrowed_from_opencode/034-tool-registry.rispec.md +110 -0
- package/rispecs/borrowed_from_opencode/035-tool-context-injection.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/036-tool-output-truncation.rispec.md +138 -0
- package/rispecs/borrowed_from_opencode/037-batch-tool.rispec.md +129 -0
- package/rispecs/borrowed_from_opencode/038-multi-edit-tool.rispec.md +167 -0
- package/rispecs/borrowed_from_opencode/039-apply-patch-tool.rispec.md +161 -0
- package/rispecs/borrowed_from_opencode/040-code-search-tool.rispec.md +143 -0
- package/rispecs/borrowed_from_opencode/041-web-fetch-tool.rispec.md +131 -0
- package/rispecs/borrowed_from_opencode/042-web-search-tool.rispec.md +159 -0
- package/rispecs/borrowed_from_opencode/043-todo-tool.rispec.md +156 -0
- package/rispecs/borrowed_from_opencode/044-plan-mode-tool.rispec.md +139 -0
- package/rispecs/borrowed_from_opencode/045-task-tool.rispec.md +146 -0
- package/rispecs/borrowed_from_opencode/046-question-tool.rispec.md +170 -0
- package/rispecs/borrowed_from_opencode/047-external-directory-tool.rispec.md +166 -0
- package/rispecs/borrowed_from_opencode/048-file-read-write-tools.rispec.md +205 -0
- package/rispecs/borrowed_from_opencode/049-lsp-server-management.rispec.md +104 -0
- package/rispecs/borrowed_from_opencode/050-lsp-hover-completion.rispec.md +102 -0
- package/rispecs/borrowed_from_opencode/051-lsp-diagnostics.rispec.md +86 -0
- package/rispecs/borrowed_from_opencode/052-lsp-root-detection.rispec.md +109 -0
- package/rispecs/borrowed_from_opencode/053-remote-mcp-servers.rispec.md +119 -0
- package/rispecs/borrowed_from_opencode/054-mcp-oauth-flow.rispec.md +107 -0
- package/rispecs/borrowed_from_opencode/055-mcp-tool-conversion.rispec.md +118 -0
- package/rispecs/borrowed_from_opencode/056-mcp-connection-monitoring.rispec.md +106 -0
- package/rispecs/borrowed_from_opencode/057-local-mcp-servers.rispec.md +116 -0
- package/rispecs/borrowed_from_opencode/058-rich-tui.rispec.md +108 -0
- package/rispecs/borrowed_from_opencode/059-streaming-display.rispec.md +116 -0
- package/rispecs/borrowed_from_opencode/060-permission-prompts.rispec.md +130 -0
- package/rispecs/borrowed_from_opencode/061-session-navigation.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/062-syntax-highlighting.rispec.md +151 -0
- package/rispecs/borrowed_from_opencode/063-keybinding-system.rispec.md +181 -0
- package/rispecs/borrowed_from_opencode/064-multi-level-config.rispec.md +155 -0
- package/rispecs/borrowed_from_opencode/065-jsonc-config.rispec.md +190 -0
- package/rispecs/borrowed_from_opencode/066-config-env-variables.rispec.md +153 -0
- package/rispecs/borrowed_from_opencode/067-config-deep-merging.rispec.md +178 -0
- package/rispecs/borrowed_from_opencode/068-remote-org-config.rispec.md +183 -0
- package/rispecs/borrowed_from_opencode/069-config-markdown-frontmatter.rispec.md +206 -0
- package/rispecs/borrowed_from_opencode/070-managed-config-directory.rispec.md +232 -0
- package/rispecs/borrowed_from_opencode/071-plugin-architecture.rispec.md +104 -0
- package/rispecs/borrowed_from_opencode/072-plugin-hooks.rispec.md +123 -0
- package/rispecs/borrowed_from_opencode/073-plugin-auto-install.rispec.md +115 -0
- package/rispecs/borrowed_from_opencode/074-permission-system.rispec.md +133 -0
- package/rispecs/borrowed_from_opencode/075-git-worktree-management.rispec.md +126 -0
- package/rispecs/borrowed_from_opencode/076-snapshot-system.rispec.md +124 -0
- package/rispecs/borrowed_from_opencode/077-snapshot-diff.rispec.md +117 -0
- package/rispecs/borrowed_from_opencode/078-snapshot-restore.rispec.md +128 -0
- package/rispecs/borrowed_from_opencode/079-worktree-branch-naming.rispec.md +122 -0
- package/rispecs/borrowed_from_opencode/080-sqlite-storage.rispec.md +134 -0
- package/rispecs/borrowed_from_opencode/081-database-migrations.rispec.md +148 -0
- package/rispecs/borrowed_from_opencode/082-database-transactions.rispec.md +138 -0
- package/rispecs/borrowed_from_opencode/083-deferred-effects.rispec.md +148 -0
- package/rispecs/borrowed_from_opencode/084-permission-rules.rispec.md +123 -0
- package/rispecs/borrowed_from_opencode/085-permission-glob-patterns.rispec.md +113 -0
- package/rispecs/borrowed_from_opencode/086-permission-merging.rispec.md +134 -0
- package/rispecs/borrowed_from_opencode/087-permission-modes.rispec.md +145 -0
- package/rispecs/borrowed_from_opencode/088-http-api-server.rispec.md +165 -0
- package/rispecs/borrowed_from_opencode/089-openapi-spec-generation.rispec.md +164 -0
- package/rispecs/borrowed_from_opencode/090-websocket-support.rispec.md +136 -0
- package/rispecs/borrowed_from_opencode/091-sse-streaming.rispec.md +168 -0
- package/rispecs/borrowed_from_opencode/092-mdns-discovery.rispec.md +145 -0
- package/rispecs/borrowed_from_opencode/093-javascript-sdk.rispec.md +200 -0
- package/rispecs/borrowed_from_opencode/094-skill-system.rispec.md +187 -0
- package/rispecs/borrowed_from_opencode/095-skill-discovery.rispec.md +182 -0
- package/rispecs/borrowed_from_opencode/096-desktop-remote-driving.rispec.md +175 -0
- package/rispecs/borrowed_from_opencode/INDEX.md +255 -0
- package/rispecs/core.rispecs.md +261 -0
- package/rispecs/engines.rispecs.md +241 -0
- package/rispecs/formatting.rispecs.md +252 -0
- package/rispecs/living-specifications.rispecs.md +361 -0
- package/rispecs/mcp.rispecs.md +197 -0
- package/rispecs/pde.rispecs.md +399 -0
- package/rispecs/pi-mono-envisionning/ENVISIONING.md +366 -0
- package/rispecs/pi-mono-envisionning/storytelling-horizon.rispecs.md +76 -0
- package/rispecs/pi-mono-envisionning/widget.rispecs.md +2 -0
- package/rispecs/relation-to-mcp-structural-thinking.kin.md +72 -0
- package/rispecs/research-for-better-framework/CLAUDE.md +7 -0
- package/rispecs/research-for-better-framework/survey-pi-openclaw-opencode-openhands.md +210 -0
- package/rispecs/session.rispecs.md +277 -0
- package/rispecs/stc.rispecs.md +138 -0
- package/rispecs/unifier.rispecs.md +317 -0
- package/scripts/LAUNCH--mcp-mia-code--testing--2603141315--ac705a66-2c15-4a1c-a26d-9491018c5ba8.sh +2 -0
- package/scripts/RESUME--mia-code--mcps--260313--ac705a66-2c15-4a1c-a26d-9491018c5ba8.sh +1 -0
- package/scripts/install-widget-in-home-pi-agent-extensions.sh +4 -0
- package/scripts/sample-decompose--2604011535-prompt.sh +1 -0
- package/skills/deep-search/AGENTS.md +17 -0
- package/skills/deep-search/SKILL.md +281 -0
- package/skills/deep-search/agent-templates.md +224 -0
- package/skills/deep-search/orchestration-patterns.md +95 -0
- package/skills/miaco-pde-inquiry-routing-deep-search/AGENTS.md +13 -0
- package/skills/miaco-pde-inquiry-routing-deep-search/SKILL.md +136 -0
- package/skills/miaco-pde-inquiry-routing-internal-external-relationship/AGENTS.md +4 -0
- package/skills/miaco-pde-inquiry-routing-internal-external-relationship/SKILL.md +157 -0
- package/skills/miaco-pde-inquiry-routing-local-qmd/AGENTS.md +42 -0
- package/skills/miaco-pde-inquiry-routing-local-qmd/SKILL.md +135 -0
- package/skills/qmd/AGENTS.md +3 -0
- package/skills/qmd/SKILL.md +144 -0
- package/skills/qmd/references/mcp-setup.md +102 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/SKILL.md +234 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/agent-templates.md +436 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/orchestration-patterns.md +197 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/ceremonial-technology.md +102 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/creative-orientation.md +99 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/prompt-decomposition.md +73 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/rise-framework.md +74 -0
- package/skills/rise-pde-inquiry-session-multi-agents-v3/references/structural-tension.md +82 -0
- package/src/cli.ts +35 -11
- package/src/geminiHeadless.ts +7 -2
- package/src/index.ts +2 -1
- package/src/mcp/miaco-server.ts +13 -1
- package/src/mcp/miatel-server.ts +13 -1
- package/src/mcp/miawa-server.ts +13 -1
- package/src/mcp/utils.ts +41 -8
- package/src/sessionStore.ts +44 -4
- package/src/types.ts +2 -1
- package/widget/mia-ceremony/README.md +36 -0
- package/widget/mia-ceremony/index.ts +143 -0
- package/widget/mia-interceptor/README.md +39 -0
- package/widget/mia-interceptor/index.ts +221 -0
- package/widget/mia-tools/README.md +37 -0
- package/widget/mia-tools/index.ts +569 -0
- package/widget/miette-echo/README.md +44 -0
- package/widget/miette-echo/index.ts +164 -0
- package/.claude/settings.local.json +0 -9
- package/.hch/issue_.env +0 -4
- package/.hch/issue_add__2601211715.json +0 -77
- package/.hch/issue_add__2601211715.md +0 -4
- package/.hch/issue_add__2602242020.json +0 -78
- package/.hch/issue_add__2602242020.md +0 -7
- package/.hch/issues.json +0 -2312
- package/.hch/issues.md +0 -30
- package/WS__mia-code__260214__IAIP_PDE.code-workspace +0 -29
- package/WS__mia-code__src332__260122.code-workspace +0 -23
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/checkpoints/index.md +0 -6
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/events.jsonl +0 -213
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/plan.md +0 -243
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/workspace.yaml +0 -5
|
@@ -0,0 +1,718 @@
|
|
|
1
|
+
# mia-code Architecture Report
|
|
2
|
+
|
|
3
|
+
> Comprehensive analysis for reusable package design
|
|
4
|
+
> Generated: 2025-07-27
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1. Executive Summary
|
|
9
|
+
|
|
10
|
+
**mia-code** is a TypeScript terminal coding agent (v0.2.1) that wraps Gemini CLI, Claude CLI, and Copilot CLI in headless mode. Its defining feature is a **dual-session architecture**: a primary agent performs work, then a second "unifier" session (always Claude) interprets the raw output into dual-perspective ceremonial output — 🧠 Mia (structural clarity) and 🌸 Miette (resonant meaning).
|
|
11
|
+
|
|
12
|
+
The system is organized around **three domain sub-CLIs** (miaco, miatel, miawa) that map to a **three-universe model** (Engineer, Story, Ceremony). These sub-CLIs are exposed both as standalone Commander.js programs and as **MCP servers** (JSON-RPC 2.0 over stdio), making them composable tools for external LLM hosts.
|
|
13
|
+
|
|
14
|
+
**Key binaries:** `mia-code` / `mia` (main), plus `miaco`, `miatel`, `miawa` (sub-CLIs)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 2. Core Architecture
|
|
19
|
+
|
|
20
|
+
### 2.1 Dual-Session Flow
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
User Prompt
|
|
24
|
+
↓
|
|
25
|
+
mia-code CLI (index.ts → cli.ts)
|
|
26
|
+
↓
|
|
27
|
+
Engine Selection (config.ts) → gemini | claude | copilot
|
|
28
|
+
↓
|
|
29
|
+
Primary Agent Session (geminiHeadless.ts)
|
|
30
|
+
→ Spawns engine CLI binary as child process
|
|
31
|
+
→ Captures GeminiJsonEvent[] stream (JSONL or buffered JSON)
|
|
32
|
+
↓
|
|
33
|
+
Unifier Session (unifier.ts)
|
|
34
|
+
→ Always Claude (requires --system-prompt)
|
|
35
|
+
→ System prompt: UNIFIER_SYSTEM_PROMPT
|
|
36
|
+
→ Input: buildSessionSummary(events, userPrompt)
|
|
37
|
+
→ 30-second timeout
|
|
38
|
+
↓
|
|
39
|
+
Formatted Output (formatting.ts)
|
|
40
|
+
→ 🧠 mia (structure): factual, architectural summary
|
|
41
|
+
→ 🌸 miette (echo): resonant reflection on meaning
|
|
42
|
+
↓
|
|
43
|
+
Session Persistence (sessionStore.ts)
|
|
44
|
+
→ ~/.mia-code-sessions.json (dual-indexed: byProjectRoot, byId)
|
|
45
|
+
→ ~/.mia-code-history/ (JSONL chat history per session)
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Fallback:** If unifier fails → `renderEventsToText()` shows raw output directly.
|
|
49
|
+
|
|
50
|
+
### 2.2 CLI Modes
|
|
51
|
+
|
|
52
|
+
| Mode | Command | Behavior |
|
|
53
|
+
|------|---------|----------|
|
|
54
|
+
| Interactive | `mia-code chat` | REPL loop with session management, tab completion, slash commands |
|
|
55
|
+
| Single-shot | `mia-code prompt <text>` | One prompt, dual-session flow, exit |
|
|
56
|
+
| Config | `mia-code config` | View/update `~/.mia-code.json` |
|
|
57
|
+
| Sessions | `mia-code sessions` | List/clear saved sessions |
|
|
58
|
+
| MCP Config | `mia-code mcp-config` | Generate MCP server configuration JSON |
|
|
59
|
+
|
|
60
|
+
### 2.3 Interactive Features
|
|
61
|
+
|
|
62
|
+
- **Multiline input:** Ctrl+J for newline, Enter to submit
|
|
63
|
+
- **Tab completion:** `@file` references (inject file contents) and `/command` slash commands
|
|
64
|
+
- **Live dropdown:** 10-item scrollable completion with arrow key navigation
|
|
65
|
+
- **Slash commands:** `/help`, `/exit`, `/session`, `/sessions`, `/clear`, `/config`, `/add-dir`
|
|
66
|
+
- **Session resume:** Auto-resume by project root, explicit `--resume <id>`, or interactive picker
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 3. Key Types & Interfaces
|
|
71
|
+
|
|
72
|
+
### 3.1 Core Types (`src/types.ts`)
|
|
73
|
+
|
|
74
|
+
```typescript
|
|
75
|
+
type Role = "user" | "assistant" | "system";
|
|
76
|
+
type Engine = "gemini" | "claude" | "copilot";
|
|
77
|
+
|
|
78
|
+
interface MiaCodeConfig {
|
|
79
|
+
engine: Engine;
|
|
80
|
+
geminiBinary: string; // default: "gemini"
|
|
81
|
+
claudeBinary: string; // default: "claude"
|
|
82
|
+
copilotBinary: string; // default: "copilot"
|
|
83
|
+
model: string; // engine-specific default model
|
|
84
|
+
headlessOutputFormat: "json" | "stream-json";
|
|
85
|
+
defaultMode: "code" | "chat";
|
|
86
|
+
defaultProjectRoot: string | null;
|
|
87
|
+
yoloMode: boolean; // auto-approve agent actions
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
interface MiaCodeSessionMeta {
|
|
91
|
+
id: string; // UUID from agent CLI
|
|
92
|
+
startedAt: string; // ISO timestamp
|
|
93
|
+
model: string;
|
|
94
|
+
projectRoot: string | null;
|
|
95
|
+
initialized?: boolean; // engine acknowledged this session?
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
interface ChatMessage {
|
|
99
|
+
role: "user" | "assistant";
|
|
100
|
+
text: string;
|
|
101
|
+
timestamp: string;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
interface GeminiJsonEvent {
|
|
105
|
+
type: "init" | "message" | "tool_use" | "tool_result" | "error" | "result" | string;
|
|
106
|
+
session_id?: string;
|
|
107
|
+
timestamp?: string;
|
|
108
|
+
role?: Role;
|
|
109
|
+
text?: string;
|
|
110
|
+
content?: string;
|
|
111
|
+
tool?: { name: string; input: unknown };
|
|
112
|
+
result?: unknown;
|
|
113
|
+
error?: { code: string; message: string };
|
|
114
|
+
raw?: unknown;
|
|
115
|
+
[key: string]: unknown; // extensible
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 3.2 MCP Types (`src/mcp/utils.ts`)
|
|
120
|
+
|
|
121
|
+
```typescript
|
|
122
|
+
interface MCPTool {
|
|
123
|
+
name: string;
|
|
124
|
+
description: string;
|
|
125
|
+
inputSchema: object; // JSON Schema
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
interface MCPToolResult {
|
|
129
|
+
content: Array<{ type: string; text: string }>;
|
|
130
|
+
isError?: boolean;
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### 3.3 Narrative Types (`src/narrative/router.ts`)
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
interface MiaCodeEvent {
|
|
138
|
+
id: string;
|
|
139
|
+
type: "user_input" | "agent_action" | "chart_update" | "beat_created" | "ceremony_action";
|
|
140
|
+
content: string;
|
|
141
|
+
source?: "miaco" | "miatel" | "miawa";
|
|
142
|
+
metadata?: Record<string, unknown>;
|
|
143
|
+
timestamp?: Date;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface RoutingResult {
|
|
147
|
+
leadCli: "miaco" | "miatel" | "miawa";
|
|
148
|
+
leadUniverse: Universe;
|
|
149
|
+
analysis: ThreeUniverseAnalysis;
|
|
150
|
+
suggestedAction: string;
|
|
151
|
+
coherence: number;
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## 4. Engine Abstraction (`engines.rispecs.md`)
|
|
158
|
+
|
|
159
|
+
### 4.1 Multi-Engine Architecture
|
|
160
|
+
|
|
161
|
+
mia-code abstracts away the differences between three LLM CLI tools:
|
|
162
|
+
|
|
163
|
+
| Feature | Gemini CLI | Claude CLI | Copilot CLI |
|
|
164
|
+
|---------|-----------|-----------|-------------|
|
|
165
|
+
| Default Model | `gemini-2.5-pro` | `sonnet` | — |
|
|
166
|
+
| Output Format | `stream-json` (JSONL) | `json` (buffered) | `json` |
|
|
167
|
+
| Auto-Approval | `--yolo` | `--dangerously-skip-permissions` | `--dangerously-skip-permissions` |
|
|
168
|
+
| Non-Interactive | (default) | `--print` | `--print` |
|
|
169
|
+
| System Prompt | Not supported | `--system-prompt` | — |
|
|
170
|
+
| stdin | `pipe` | `ignore` (closed) | `ignore` |
|
|
171
|
+
| Session Resume | `--resume <id>` | `--resume <id>` | `--resume <id>` |
|
|
172
|
+
| Extra Dirs | `--include-directories` | `--add-dir` | `--add-dir` |
|
|
173
|
+
|
|
174
|
+
### 4.2 Engine Selection Priority
|
|
175
|
+
|
|
176
|
+
1. CLI flag: `--claude`, `--gemini`, `--copilot`
|
|
177
|
+
2. Environment variable: `MIA_CODE_ENGINE`
|
|
178
|
+
3. Config file: `~/.mia-code.json`
|
|
179
|
+
4. Default: `gemini`
|
|
180
|
+
|
|
181
|
+
### 4.3 Output Normalization
|
|
182
|
+
|
|
183
|
+
- **Gemini:** JSONL lines → parse each as `GeminiJsonEvent`
|
|
184
|
+
- **Claude/Copilot:** Single buffered JSON → convert `{ type: "result", result, session_id }` → normalized event
|
|
185
|
+
- Session ID discovery from event stream (init event or result event)
|
|
186
|
+
- Exit code 42 = invalid/expired session → graceful recovery
|
|
187
|
+
|
|
188
|
+
### 4.4 Unifier Constraint
|
|
189
|
+
|
|
190
|
+
The unifier session **always uses Claude** because:
|
|
191
|
+
- Gemini lacks `--system-prompt` flag
|
|
192
|
+
- Without it, system instructions leak into output
|
|
193
|
+
- Claude's `--system-prompt` keeps ceremonial instructions separate from response
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
## 5. RISE Specification Index
|
|
198
|
+
|
|
199
|
+
### 5.1 Implemented Specifications (7)
|
|
200
|
+
|
|
201
|
+
| File | Domain | Status |
|
|
202
|
+
|------|--------|--------|
|
|
203
|
+
| `core.rispecs.md` | CLI architecture, dual-session flow, components | ✅ Complete |
|
|
204
|
+
| `engines.rispecs.md` | Multi-engine support, argument translation | ✅ Complete |
|
|
205
|
+
| `unifier.rispecs.md` | Ceremonial interpretation, Mia+Miette | ✅ Complete |
|
|
206
|
+
| `session.rispecs.md` | Session persistence, auto-resume | ✅ Complete |
|
|
207
|
+
| `formatting.rispecs.md` | Terminal output styling, visual hierarchy | ✅ Complete |
|
|
208
|
+
| `mcp.rispecs.md` | MCP server architecture (3 servers, 18 tools) | ✅ Complete |
|
|
209
|
+
| `stc.rispecs.md` | PDE → Structural Tension Chart conversion | ✅ Complete |
|
|
210
|
+
|
|
211
|
+
### 5.2 Draft Specifications (1)
|
|
212
|
+
|
|
213
|
+
| File | Domain | Status |
|
|
214
|
+
|------|--------|--------|
|
|
215
|
+
| `pde.rispecs.md` | Prompt Decomposition Engine integration | 📝 Draft |
|
|
216
|
+
|
|
217
|
+
### 5.3 Enhancement Specifications (1)
|
|
218
|
+
|
|
219
|
+
| File | Domain | Status |
|
|
220
|
+
|------|--------|--------|
|
|
221
|
+
| `living-specifications.rispecs.md` | RispecsEngine: auto-updating specs from git | Enhancement |
|
|
222
|
+
|
|
223
|
+
### 5.4 Kinship/Relationship Documents (1)
|
|
224
|
+
|
|
225
|
+
| File | Domain |
|
|
226
|
+
|------|--------|
|
|
227
|
+
| `relation-to-mcp-structural-thinking.kin.md` | Integration with mcp-structural-thinking diagnostic layer |
|
|
228
|
+
|
|
229
|
+
### 5.5 Key Rispec Details
|
|
230
|
+
|
|
231
|
+
#### `core.rispecs.md`
|
|
232
|
+
Defines the complete CLI architecture: PromptInput, ThinkingIndicator, CeremonialOutput components. Documents the interactive chat session, single prompt mode, configuration view, and session list screens. Establishes the dual-session pattern as the foundational architecture.
|
|
233
|
+
|
|
234
|
+
#### `unifier.rispecs.md`
|
|
235
|
+
Specifies the UNIFIER_SYSTEM_PROMPT that instructs Claude to produce dual-perspective output. Key rules: 2-4 sentences per section max, no literal technical summaries (distill essence), no unsolicited suggestions. Mia uses objective language ("adequate", "functional"), Miette seeks "truth that makes someone nod in recognition."
|
|
236
|
+
|
|
237
|
+
#### `mcp.rispecs.md`
|
|
238
|
+
Documents all 18 MCP tools across 3 servers. Tool execution delegates to sub-CLIs via `child_process.spawn` with `--json` flag. Uses `@modelcontextprotocol/sdk` Server + StdioServerTransport. Each `*-server.ts` has dual-purpose: library mode (exports) and server mode (standalone run).
|
|
239
|
+
|
|
240
|
+
#### `pde.rispecs.md` (DRAFT)
|
|
241
|
+
Envisions a five-layer decomposition pipeline: Intent Extraction → Dependency Graph → Medicine Wheel Direction Assignment → Workflow Template → Execution Plan. Draws from academic research (DecomP, CoT, ReAct, HTN). Not yet implemented in mia-code directly but parts exist via mcp-pde integration.
|
|
242
|
+
|
|
243
|
+
#### `stc.rispecs.md`
|
|
244
|
+
Documents the PDE-to-STC conversion pipeline: `.pde/*.json` → Entity/Relation JSONL compatible with coaia-narrative. Supports deterministic (zero-LLM) and LLM-assisted modes. Entity naming: `chart_{8-char-uuid}_{component}`. Validated with 6 deterministic conversions (15-31 entities each).
|
|
245
|
+
|
|
246
|
+
#### `living-specifications.rispecs.md`
|
|
247
|
+
Proposes a RispecsEngine that watches git commits, detects specification drift, suggests spec updates from conventional commit messages, maintains source references with auto-refresh, and integrates as git hooks for continuous validation.
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 6. MCP Server Architecture (`mcp.rispecs.md`)
|
|
252
|
+
|
|
253
|
+
### 6.1 Three-Server Topology
|
|
254
|
+
|
|
255
|
+
```
|
|
256
|
+
Claude Code / any MCP host
|
|
257
|
+
│
|
|
258
|
+
├── stdio ──→ miaco-server.js (Engineering World — 8 tools)
|
|
259
|
+
├── stdio ──→ miatel-server.js (Story World — 4 tools)
|
|
260
|
+
└── stdio ──→ miawa-server.js (Ceremony World — 6 tools)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### 6.2 Module Structure
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
src/mcp/
|
|
267
|
+
├── utils.ts # Shared: MCPTool/MCPToolResult, runCLI, bootstrapMCPServer
|
|
268
|
+
├── miaco-server.ts # 8 tools: charts (5) + PDE (3)
|
|
269
|
+
├── miatel-server.ts # 4 tools: beats (create, list, analyze, enrich)
|
|
270
|
+
├── miawa-server.ts # 6 tools: ceremonies (init, list, advance, close, wisdom, stage)
|
|
271
|
+
├── config-generator.ts # Generates MCP config JSON for host setup
|
|
272
|
+
└── index.ts # Registry: exports + routing by name prefix
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### 6.3 Tool Catalog (18 tools)
|
|
276
|
+
|
|
277
|
+
#### miaco (Engineering World) — 8 tools
|
|
278
|
+
|
|
279
|
+
| Tool | Purpose |
|
|
280
|
+
|------|---------|
|
|
281
|
+
| `miaco_chart_create` | Create structural tension chart (outcome vs reality) |
|
|
282
|
+
| `miaco_chart_list` | List active charts |
|
|
283
|
+
| `miaco_chart_add_step` | Add action step to chart |
|
|
284
|
+
| `miaco_chart_complete` | Mark step complete |
|
|
285
|
+
| `miaco_chart_review` | Creator Moment of Truth review |
|
|
286
|
+
| `miaco_decompose` | Run PDE Four Directions decomposition |
|
|
287
|
+
| `miaco_decompose_list` | List stored decompositions |
|
|
288
|
+
| `miaco_decompose_get` | Get specific decomposition by UUID |
|
|
289
|
+
|
|
290
|
+
#### miatel (Story World) — 4 tools
|
|
291
|
+
|
|
292
|
+
| Tool | Purpose |
|
|
293
|
+
|------|---------|
|
|
294
|
+
| `miatel_beat_create` | Create story beat (text, character, tone, phase) |
|
|
295
|
+
| `miatel_beat_list` | List beats with optional character filter |
|
|
296
|
+
| `miatel_beat_analyze` | Analyze beat with universe lens |
|
|
297
|
+
| `miatel_beat_enrich` | Apply enrichment (sensory/stakes/dialogue) |
|
|
298
|
+
|
|
299
|
+
#### miawa (Ceremony World) — 6 tools
|
|
300
|
+
|
|
301
|
+
| Tool | Purpose |
|
|
302
|
+
|------|---------|
|
|
303
|
+
| `miawa_ceremony_init` | Start ceremony (title, type, intention) |
|
|
304
|
+
| `miawa_ceremony_list` | List ceremonies |
|
|
305
|
+
| `miawa_ceremony_advance` | Progress to next movement (1-4) |
|
|
306
|
+
| `miawa_ceremony_close` | End ceremony with wisdom archiving |
|
|
307
|
+
| `miawa_ceremony_wisdom` | Retrieve completed ceremony wisdom |
|
|
308
|
+
| `miawa_ceremony_stage` | Check current stage and Four Movements |
|
|
309
|
+
|
|
310
|
+
### 6.4 Namespace-Prefix Routing
|
|
311
|
+
|
|
312
|
+
Tools are dispatched by name prefix in `src/mcp/index.ts`:
|
|
313
|
+
|
|
314
|
+
```typescript
|
|
315
|
+
function handleTool(name: string, args: Record<string, unknown>) {
|
|
316
|
+
if (name.startsWith("miaco_")) return handleMiacoTool(name, args);
|
|
317
|
+
if (name.startsWith("miatel_")) return handleMiatelTool(name, args);
|
|
318
|
+
if (name.startsWith("miawa_")) return handleMiawaTool(name, args);
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Each server delegates to its sub-CLI via `child_process.spawn`:
|
|
323
|
+
```
|
|
324
|
+
tools/call → handleMiacoTool → buildArgs → runCLI(MIACO_PATH, [...args, "--json"])
|
|
325
|
+
→ spawn("node", [miaco/dist/index.js, ...]) → parseJSONOutput → createToolResult
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
### 6.5 Config Generation
|
|
329
|
+
|
|
330
|
+
```bash
|
|
331
|
+
mia-code mcp-config # JSON config for Claude Code
|
|
332
|
+
mia-code mcp-config --tools # Tool manifest (all tools with schemas)
|
|
333
|
+
mia-code mcp-config --info # Server metadata + tools
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## 7. Widget/Extension System
|
|
339
|
+
|
|
340
|
+
Four Pi-compatible extensions in `widget/` that integrate mia-code capabilities into the [Pi coding agent](https://github.com/nickelization/pi-coding-agent) TUI:
|
|
341
|
+
|
|
342
|
+
### 7.1 mia-ceremony — Four Movements Footer
|
|
343
|
+
|
|
344
|
+
**File:** `widget/mia-ceremony/index.ts`
|
|
345
|
+
**Platform:** `@mariozechner/pi-coding-agent` extension API
|
|
346
|
+
|
|
347
|
+
Tracks ceremony phase in Pi's footer status bar with automatic transitions:
|
|
348
|
+
|
|
349
|
+
| Phase | Emoji | Trigger |
|
|
350
|
+
|-------|-------|---------|
|
|
351
|
+
| EAST — Gathering | 🌅 | Session start, PDE decompose |
|
|
352
|
+
| SOUTH — Building | 🔥 | STC chart create |
|
|
353
|
+
| WEST — Validating | 🌊 | STC steps completed (≥2) |
|
|
354
|
+
| NORTH — Completing | ❄️ | STC review |
|
|
355
|
+
|
|
356
|
+
**State tracking:** `CeremonyState` with `phase`, `turnCount`, `pdeUsed`, `chartCreated`, `stepsCompleted`, `reviewDone`.
|
|
357
|
+
|
|
358
|
+
**Events:** `session_start`, `session_switch`, `session_shutdown`, `turn_end`, `tool_execution_end`.
|
|
359
|
+
|
|
360
|
+
**Commands:** `/ceremony` (show phase), `/ceremony south` (manual set).
|
|
361
|
+
|
|
362
|
+
### 7.2 mia-interceptor — Proactive PDE Sensing
|
|
363
|
+
|
|
364
|
+
**File:** `widget/mia-interceptor/index.ts`
|
|
365
|
+
|
|
366
|
+
Hooks `on("input")` to detect complex prompts before they reach the agent:
|
|
367
|
+
|
|
368
|
+
1. **Complexity assessment:** Counts distinct verb groups (creating, modifying, analyzing, deploying, testing, etc.) from 45+ action verbs
|
|
369
|
+
2. **Implicit intent detection:** Scans for hedging markers ("I assume", "somehow", "make sure")
|
|
370
|
+
3. **Threshold:** Score ≥ 3 areas → prompts user: "🌅 This prompt touches N areas — want to decompose first?"
|
|
371
|
+
4. **On yes:** Runs `miaco decompose run -e claude` and shows PDE result in chat
|
|
372
|
+
5. **On no:** Continues normally
|
|
373
|
+
6. **Cooldown:** Won't ask again for 5 turns
|
|
374
|
+
|
|
375
|
+
**Key design:** Never blocks. Always a yes/no question. Short prompts (<30 chars) and slash commands are ignored.
|
|
376
|
+
|
|
377
|
+
### 7.3 mia-tools — PDE + STC as Pi Extension
|
|
378
|
+
|
|
379
|
+
**File:** `widget/mia-tools/index.ts`
|
|
380
|
+
**Deps:** `@mariozechner/pi-ai` (Type), `@mariozechner/pi-tui` (Box, Text)
|
|
381
|
+
|
|
382
|
+
Registers 6 LLM-callable tools and 2 slash commands:
|
|
383
|
+
|
|
384
|
+
**LLM Tools:**
|
|
385
|
+
- `pde_decompose` — With custom `renderResult` showing primary intent, directions (🌅🔥🌊❄️), action stack
|
|
386
|
+
- `stc_create` — With visual tension chart renderer (OUTCOME ↑ TENSION ↑ REALITY)
|
|
387
|
+
- `stc_add_step`, `stc_complete_step`, `stc_review`, `stc_list`
|
|
388
|
+
|
|
389
|
+
**Slash Commands:**
|
|
390
|
+
- `/pde <prompt>` — Decompose; `/pde` lists recent decompositions from `.pde/`
|
|
391
|
+
- `/stc [create|list]` — Interactive chart creation with prompts
|
|
392
|
+
|
|
393
|
+
**Custom message renderer:** `pde-result` type renders decomposition with emoji direction counts, action stack (expandable), and ambiguity warnings.
|
|
394
|
+
|
|
395
|
+
### 7.4 miette-echo — Below-Editor Widget
|
|
396
|
+
|
|
397
|
+
**File:** `widget/miette-echo/index.ts`
|
|
398
|
+
|
|
399
|
+
**Two-Eye-Seen pattern:** Look up → 🧠 Mia's work (the agent). Look down → 🌸 Miette's echo (this widget).
|
|
400
|
+
|
|
401
|
+
**Mechanism:**
|
|
402
|
+
1. Injects instruction into system prompt via `before_agent_start` hook: instructs agent to end every response with `<miette>reflection</miette>` tag
|
|
403
|
+
2. On `message_end`: regex-extracts `<miette>...</miette>`, strips it from displayed message
|
|
404
|
+
3. Renders extracted echo as a persistent widget below the input editor via `setWidget("miette-echo", ..., { placement: "belowEditor" })`
|
|
405
|
+
4. Persists echoes to `.miette/YYMMDD.md` (timestamped markdown entries)
|
|
406
|
+
|
|
407
|
+
**Commands:** `/miette` (show last echo), `/miette off` (hide), `/miette on` (show)
|
|
408
|
+
|
|
409
|
+
**Design:** Never interrupts. If extraction fails, rests silently. Never breaks the session.
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## 8. Narrative Intelligence Layer
|
|
414
|
+
|
|
415
|
+
### 8.1 Three-Universe Router (`src/narrative/router.ts`)
|
|
416
|
+
|
|
417
|
+
Maps between the three-universe model and mia-code sub-CLIs:
|
|
418
|
+
|
|
419
|
+
| Universe | Perspective | Sub-CLI |
|
|
420
|
+
|----------|------------|---------|
|
|
421
|
+
| ENGINEER | Technical precision | miaco |
|
|
422
|
+
| CEREMONY | Relational protocols | miawa |
|
|
423
|
+
| STORY_ENGINE | Narrative patterns | miatel |
|
|
424
|
+
|
|
425
|
+
**NarrativeRouter class:**
|
|
426
|
+
- `route(event)` → Runs `ThreeUniverseProcessor.process()`, returns `RoutingResult` with lead CLI, analysis, coherence score
|
|
427
|
+
- `recordBeat(content, cli)` → Creates `StoryBeat` with emotional tone classification and narrative function inference
|
|
428
|
+
- `analyzeCoherence()` → Uses `NarrativeCoherenceEngine` on accumulated beat history
|
|
429
|
+
- `getTrinityAssessment()` → Mia/Miette/Ava8 quality perspectives
|
|
430
|
+
- `getGaps()` → Identifies narrative gaps with type/severity/description
|
|
431
|
+
|
|
432
|
+
**Narrative function inference:** Keyword-based mapping (begin/start → INCITING_INCIDENT, complete/done → RESOLUTION, problem/bug → COMPLICATION, breakthrough → TURNING_POINT, default → RISING_ACTION).
|
|
433
|
+
|
|
434
|
+
### 8.2 Narrative Tracer (`src/narrative/tracer.ts`)
|
|
435
|
+
|
|
436
|
+
**MiaCodeTracer class** wraps `NarrativeTracingHandler` for observability:
|
|
437
|
+
|
|
438
|
+
**Operations tracked:** `chart_create`, `chart_update`, `chart_complete`, `beat_create`, `beat_analyze`, `ceremony_init`, `ceremony_advance`, `user_input`, `agent_response`, `routing_decision`
|
|
439
|
+
|
|
440
|
+
**Metrics:** `beatsGenerated`, `enrichmentsApplied`, `routingDecisions`, alignment scores (engineer/ceremony/storyEngine), `crossUniverseCoherence`, timing
|
|
441
|
+
|
|
442
|
+
**Singleton pattern:** `getTracer(sessionId)` caches instances per session. `removeTracer()` for cleanup.
|
|
443
|
+
|
|
444
|
+
**Integration:** Langfuse-backed via `LANGFUSE_PUBLIC_KEY` / `LANGFUSE_SECRET_KEY` env vars. Correlation headers: `X-Mia-Session-Id`, `X-Mia-Trace-Start`.
|
|
445
|
+
|
|
446
|
+
---
|
|
447
|
+
|
|
448
|
+
## 9. Dependencies
|
|
449
|
+
|
|
450
|
+
### 9.1 Runtime Dependencies
|
|
451
|
+
|
|
452
|
+
| Package | Purpose |
|
|
453
|
+
|---------|---------|
|
|
454
|
+
| `@modelcontextprotocol/sdk` ^1.27.1 | MCP protocol (Server, StdioServerTransport) |
|
|
455
|
+
| `commander` ^12.0.0 | CLI parsing |
|
|
456
|
+
| `chalk` ^5.3.0 | Terminal color styling |
|
|
457
|
+
| `ora` ^8.0.0 | Spinner animations |
|
|
458
|
+
| `enquirer` ^2.4.1 | Interactive prompts |
|
|
459
|
+
| `ava-langchain-inquiry-routing` ^0.1.0 | Inquiry routing (LangChain fork) |
|
|
460
|
+
| `ava-langchain-narrative-tracing` ^0.1.1 | Narrative tracing/observability |
|
|
461
|
+
| `ava-langchain-prompt-decomposition` ^0.1.4 | Prompt decomposition |
|
|
462
|
+
| `ava-langchain-relational-intelligence` ^0.1.2 | Relational intelligence |
|
|
463
|
+
| `ava-langgraph-narrative-intelligence` ^0.1.1 | Three-universe narrative analysis |
|
|
464
|
+
| `ava-langgraph-prompt-decomposition-engine` ^0.1.3 | PDE via LangGraph |
|
|
465
|
+
| `medicine-wheel-ontology-core` ^0.1.1 | Medicine wheel ontology |
|
|
466
|
+
| `medicine-wheel-relational-query` ^0.1.1 | Relational queries |
|
|
467
|
+
| `medicine-wheel-narrative-engine` ^0.1.1 | Narrative engine |
|
|
468
|
+
| `medicine-wheel-graph-viz` ^0.1.1 | Graph visualization |
|
|
469
|
+
|
|
470
|
+
### 9.2 Dev Dependencies
|
|
471
|
+
|
|
472
|
+
| Package | Purpose |
|
|
473
|
+
|---------|---------|
|
|
474
|
+
| `typescript` ^5.6.0 | Compilation |
|
|
475
|
+
| `tsx` ^4.7.0 | Dev mode execution |
|
|
476
|
+
| `@types/node` ^22.0.0 | Node.js type definitions |
|
|
477
|
+
|
|
478
|
+
### 9.3 Build Configuration
|
|
479
|
+
|
|
480
|
+
```json
|
|
481
|
+
{
|
|
482
|
+
"target": "ES2022",
|
|
483
|
+
"module": "NodeNext",
|
|
484
|
+
"moduleResolution": "NodeNext",
|
|
485
|
+
"outDir": "dist",
|
|
486
|
+
"rootDir": "src",
|
|
487
|
+
"strict": true
|
|
488
|
+
}
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
---
|
|
492
|
+
|
|
493
|
+
## 10. Sub-CLI Architecture
|
|
494
|
+
|
|
495
|
+
### 10.1 miaco (Engineering World)
|
|
496
|
+
|
|
497
|
+
Located at `mia-code/miaco/`. Commander.js CLI with:
|
|
498
|
+
- **Chart commands:** `chart create`, `chart list`, `chart add-step`, `chart complete`, `chart review`
|
|
499
|
+
- **Decompose commands:** `decompose run`, `decompose list`, `decompose get`
|
|
500
|
+
- **STC commands:** `stc convert`, `stc list`, `stc validate`
|
|
501
|
+
- All commands support `--json` output for MCP delegation
|
|
502
|
+
|
|
503
|
+
### 10.2 miatel (Story World)
|
|
504
|
+
|
|
505
|
+
Located at `mia-code/miatel/`. Commander.js CLI with:
|
|
506
|
+
- **Beat commands:** `beat create`, `beat list`, `beat analyze`, `beat enrich`
|
|
507
|
+
- Emotional tone enum for beat classification
|
|
508
|
+
- Universe lens analysis (engineer/ceremony/story_engine/all)
|
|
509
|
+
|
|
510
|
+
### 10.3 miawa (Ceremony World)
|
|
511
|
+
|
|
512
|
+
Located at `mia-code/miawa/`. Commander.js CLI with:
|
|
513
|
+
- **Ceremony commands:** `ceremony init`, `ceremony list`, `ceremony advance`, `ceremony close`, `ceremony wisdom`, `ceremony stage`
|
|
514
|
+
- Four Movements lifecycle (1-4)
|
|
515
|
+
- Ceremony types: group_reflection, seasonal, healing_circle, wisdom_sharing
|
|
516
|
+
|
|
517
|
+
---
|
|
518
|
+
|
|
519
|
+
## 11. Session Management (`session.rispecs.md`)
|
|
520
|
+
|
|
521
|
+
### 11.1 Session Lifecycle
|
|
522
|
+
|
|
523
|
+
```
|
|
524
|
+
First Prompt → Agent CLI generates session_id → Capture from event stream
|
|
525
|
+
→ Create MiaCodeSessionMeta → Persist to ~/.mia-code-sessions.json
|
|
526
|
+
→ Subsequent prompts: --resume <sessionId>
|
|
527
|
+
```
|
|
528
|
+
|
|
529
|
+
### 11.2 Session Index
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
interface SessionIndex {
|
|
533
|
+
byProjectRoot: Record<string, MiaCodeSessionMeta>; // project → session
|
|
534
|
+
byId: Record<string, MiaCodeSessionMeta>; // id → session
|
|
535
|
+
}
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
### 11.3 Resume Modes
|
|
539
|
+
|
|
540
|
+
| Mode | Trigger | Behavior |
|
|
541
|
+
|------|---------|----------|
|
|
542
|
+
| Auto-resume | Default (no flag) | Lookup by projectRoot |
|
|
543
|
+
| Explicit ID | `--resume abc123` | Use specific session |
|
|
544
|
+
| Interactive | `--resume` (no ID) | Display picker |
|
|
545
|
+
| New session | No existing session | Generate on first prompt |
|
|
546
|
+
|
|
547
|
+
### 11.4 Chat History
|
|
548
|
+
|
|
549
|
+
- Format: JSONL files in `~/.mia-code-history/`
|
|
550
|
+
- Per-session files with sanitized filenames
|
|
551
|
+
- `saveChatMessage()` / `loadChatHistory()` for persistence
|
|
552
|
+
|
|
553
|
+
---
|
|
554
|
+
|
|
555
|
+
## 12. Output Formatting (`formatting.rispecs.md`)
|
|
556
|
+
|
|
557
|
+
### 12.1 Color Semantics
|
|
558
|
+
|
|
559
|
+
| Element | Color | Symbol |
|
|
560
|
+
|---------|-------|--------|
|
|
561
|
+
| User prompt | Yellow | `you>` |
|
|
562
|
+
| Session metadata | Dim | — |
|
|
563
|
+
| Agent header | Green bold | 🧠🌸 |
|
|
564
|
+
| Error | Red | ❌ |
|
|
565
|
+
| Success | Green | ✓ |
|
|
566
|
+
| Warning | Yellow | ⚠ |
|
|
567
|
+
| Tool events | Magenta | 🔧 |
|
|
568
|
+
| Processing | Dim | ⏳ |
|
|
569
|
+
|
|
570
|
+
### 12.2 Render Options
|
|
571
|
+
|
|
572
|
+
```typescript
|
|
573
|
+
interface RenderOptions {
|
|
574
|
+
showRawToolEvents?: boolean; // Display tool use/result events
|
|
575
|
+
showTimestamps?: boolean; // Include event timestamps
|
|
576
|
+
compact?: boolean; // Minimal output mode
|
|
577
|
+
}
|
|
578
|
+
```
|
|
579
|
+
|
|
580
|
+
---
|
|
581
|
+
|
|
582
|
+
## 13. Relationships to Other Projects
|
|
583
|
+
|
|
584
|
+
### 13.1 Direct Dependencies (KINSHIP.md)
|
|
585
|
+
|
|
586
|
+
| Project | Relationship |
|
|
587
|
+
|---------|-------------|
|
|
588
|
+
| **mcp-pde** (`/src/mcp-pde/`) | PDE v2 — session-start decomposition workflow. Types from IAIP canonical source. |
|
|
589
|
+
| **coaia-narrative** | STC JSONL output target. Entity/Relation records consumed by visualizer and MCP. |
|
|
590
|
+
| **coaia-visualizer** | Renders STC charts produced by `miaco stc convert`. |
|
|
591
|
+
| **coaia-planning** | Action planning via Structural Tension Charts. |
|
|
592
|
+
| **mcp-structural-thinking** | Diagnostic tools for session observation and validation. Three-universe consensus checks. |
|
|
593
|
+
| **IAIP** (`/src/IAIP/`) | Canonical PDE types from `IAIP/lib/pde/types.ts`. Academic research foundation. |
|
|
594
|
+
|
|
595
|
+
### 13.2 LangChain/LangGraph Forks
|
|
596
|
+
|
|
597
|
+
mia-code uses custom forks of LangChain and LangGraph:
|
|
598
|
+
|
|
599
|
+
| Package | Source | Used For |
|
|
600
|
+
|---------|--------|----------|
|
|
601
|
+
| `ava-langgraph-narrative-intelligence` | `/workspace/repos/avadisabelle/ava-langgraphjs` | Three-universe processor, story beats, coherence |
|
|
602
|
+
| `ava-langchain-narrative-tracing` | `/workspace/repos/avadisabelle/ava-langchainjs` | Narrative observability, Langfuse integration |
|
|
603
|
+
| `ava-langchain-prompt-decomposition` | Same repo | PDE via LangChain |
|
|
604
|
+
| `ava-langchain-inquiry-routing` | Same repo | Inquiry routing |
|
|
605
|
+
| `medicine-wheel-*` packages | — | Ontology, relational queries, narrative engine, visualization |
|
|
606
|
+
|
|
607
|
+
### 13.3 Three-Universe ↔ Three Sub-CLI Alignment
|
|
608
|
+
|
|
609
|
+
| Sub-CLI | Universe | mcp-structural-thinking Lens |
|
|
610
|
+
|---------|----------|------------------------------|
|
|
611
|
+
| miaco (Engineer) | ENGINEER | Mia (Technical) |
|
|
612
|
+
| miatel (Story) | STORY_ENGINE | Miette (Narrative) |
|
|
613
|
+
| miawa (Ceremony) | CEREMONY | Ava (Relational) |
|
|
614
|
+
|
|
615
|
+
### 13.4 Convergence Architecture (from KINSHIP.md)
|
|
616
|
+
|
|
617
|
+
The `.mw/` directory architecture maps sub-CLI outputs to Medicine Wheel directions:
|
|
618
|
+
- `miaco decompose` → writes to `.mw/east/` (PDE decompositions)
|
|
619
|
+
- `miaco stc convert` → reads `.mw/east/`, writes to `.mw/south/` (Entity/Relation JSONL)
|
|
620
|
+
- `miaco chart create` → currently writes flat JSON (pending migration to JSONL in `.mw/south/`)
|
|
621
|
+
|
|
622
|
+
---
|
|
623
|
+
|
|
624
|
+
## 14. Source File Map
|
|
625
|
+
|
|
626
|
+
```
|
|
627
|
+
mia-code/
|
|
628
|
+
├── src/
|
|
629
|
+
│ ├── index.ts # Entry point: Commander CLI with chat, prompt, config, sessions, mcp-config
|
|
630
|
+
│ ├── cli.ts # Interactive REPL: readline, tab completion, multiline, session resume
|
|
631
|
+
│ ├── commands.ts # Slash command registry (7 commands with aliases)
|
|
632
|
+
│ ├── config.ts # Config load/save (~/.mia-code.json), env var overrides
|
|
633
|
+
│ ├── types.ts # Core types: Engine, MiaCodeConfig, GeminiJsonEvent, etc.
|
|
634
|
+
│ ├── geminiHeadless.ts # Engine binary spawner: runGeminiHeadless(), streamGemini()
|
|
635
|
+
│ ├── unifier.ts # Ceremonial interpreter: runUnifierSession(), buildSessionSummary()
|
|
636
|
+
│ ├── formatting.ts # Terminal output: renderEventsToText(), formatHeader(), etc.
|
|
637
|
+
│ ├── multiline-input.ts # Raw TTY input: MultilineInput class (740 lines)
|
|
638
|
+
│ ├── sessionStore.ts # Session persistence: JSONL chat history, dual-indexed sessions
|
|
639
|
+
│ ├── mcp/
|
|
640
|
+
│ │ ├── index.ts # Registry: exports all servers, handleTool() router
|
|
641
|
+
│ │ ├── utils.ts # Shared: MCPTool, runCLI, bootstrapMCPServer
|
|
642
|
+
│ │ ├── miaco-server.ts # 8 tools (charts + PDE)
|
|
643
|
+
│ │ ├── miatel-server.ts # 4 tools (beats)
|
|
644
|
+
│ │ ├── miawa-server.ts # 6 tools (ceremonies)
|
|
645
|
+
│ │ └── config-generator.ts # MCP config JSON generation
|
|
646
|
+
│ └── narrative/
|
|
647
|
+
│ ├── index.ts # Re-exports router + tracer
|
|
648
|
+
│ ├── router.ts # NarrativeRouter: three-universe routing
|
|
649
|
+
│ └── tracer.ts # MiaCodeTracer: narrative observability
|
|
650
|
+
├── widget/
|
|
651
|
+
│ ├── mia-ceremony/ # Four Movements footer widget
|
|
652
|
+
│ ├── mia-interceptor/ # Proactive PDE sensing
|
|
653
|
+
│ ├── mia-tools/ # PDE + STC as Pi tools/commands
|
|
654
|
+
│ └── miette-echo/ # Below-editor echo widget
|
|
655
|
+
├── rispecs/ # 11 specification files
|
|
656
|
+
├── miaco/ # Engineering sub-CLI
|
|
657
|
+
├── miatel/ # Story sub-CLI
|
|
658
|
+
├── miawa/ # Ceremony sub-CLI
|
|
659
|
+
├── package.json
|
|
660
|
+
└── tsconfig.json
|
|
661
|
+
```
|
|
662
|
+
|
|
663
|
+
---
|
|
664
|
+
|
|
665
|
+
## 15. Extractable Package Boundaries
|
|
666
|
+
|
|
667
|
+
Based on this analysis, the following are natural package extraction candidates:
|
|
668
|
+
|
|
669
|
+
### 15.1 `@mia-code/types` — Core type definitions
|
|
670
|
+
- `Engine`, `Role`, `MiaCodeConfig`, `MiaCodeSessionMeta`, `ChatMessage`, `GeminiJsonEvent`
|
|
671
|
+
- Zero dependencies, pure TypeScript interfaces
|
|
672
|
+
|
|
673
|
+
### 15.2 `@mia-code/engine-abstraction` — Multi-engine wrapper
|
|
674
|
+
- `runGeminiHeadless()`, `streamGemini()`
|
|
675
|
+
- Engine-specific argument translation, output normalization
|
|
676
|
+
- Deps: `child_process`
|
|
677
|
+
|
|
678
|
+
### 15.3 `@mia-code/unifier` — Ceremonial interpretation
|
|
679
|
+
- `runUnifierSession()`, `buildSessionSummary()`
|
|
680
|
+
- UNIFIER_SYSTEM_PROMPT
|
|
681
|
+
- Deps: engine-abstraction (for Claude spawning)
|
|
682
|
+
|
|
683
|
+
### 15.4 `@mia-code/session-store` — Session persistence
|
|
684
|
+
- Session index (byProjectRoot, byId), chat history (JSONL)
|
|
685
|
+
- `rememberSession()`, `getLastSessionForProject()`, `saveChatMessage()`, `loadChatHistory()`
|
|
686
|
+
- Deps: `fs`, `path`
|
|
687
|
+
|
|
688
|
+
### 15.5 `@mia-code/mcp-servers` — MCP tool servers
|
|
689
|
+
- Three servers (miaco, miatel, miawa) with `bootstrapMCPServer()`
|
|
690
|
+
- Config generator, tool manifests
|
|
691
|
+
- Deps: `@modelcontextprotocol/sdk`, sub-CLI binaries
|
|
692
|
+
|
|
693
|
+
### 15.6 `@mia-code/narrative` — Three-universe routing + tracing
|
|
694
|
+
- `NarrativeRouter`, `MiaCodeTracer`
|
|
695
|
+
- Deps: `ava-langgraph-narrative-intelligence`, `ava-langchain-narrative-tracing`
|
|
696
|
+
|
|
697
|
+
### 15.7 `@mia-code/widgets` — Pi extension widgets
|
|
698
|
+
- Four widgets, each independently loadable
|
|
699
|
+
- Deps: `@mariozechner/pi-coding-agent`, `@mariozechner/pi-tui`
|
|
700
|
+
|
|
701
|
+
### 15.8 `@mia-code/formatting` — Terminal output formatting
|
|
702
|
+
- `renderEventsToText()`, `formatHeader()`, `formatError()`, etc.
|
|
703
|
+
- Deps: `chalk`
|
|
704
|
+
|
|
705
|
+
---
|
|
706
|
+
|
|
707
|
+
## 16. Key Design Patterns
|
|
708
|
+
|
|
709
|
+
1. **Dual-Session Architecture:** Every interaction produces both technical clarity (Mia) and resonant meaning (Miette)
|
|
710
|
+
2. **Engine Abstraction:** Engine selection is configuration, not interface change
|
|
711
|
+
3. **Namespace-Prefix Routing:** MCP tools dispatched by `miaco_` / `miatel_` / `miawa_` prefix
|
|
712
|
+
4. **Graceful Degradation:** Unifier failures fall back to raw output; widget failures rest silently
|
|
713
|
+
5. **Sub-CLI Delegation:** MCP servers delegate to sub-CLIs via `child_process.spawn` with `--json`
|
|
714
|
+
6. **Three-Universe Model:** Engineer/Ceremony/Story_Engine maps consistently across all layers
|
|
715
|
+
7. **Per-Project Sessions:** Dual-indexed (byProjectRoot, byId) for both auto-resume and explicit selection
|
|
716
|
+
8. **Ceremonial Lifecycle:** Four Movements (EAST→SOUTH→WEST→NORTH) tracked via tool usage patterns
|
|
717
|
+
9. **Creative Orientation (RISE):** Specs focus on "what users create" not "problems solved"
|
|
718
|
+
10. **Singleton Patterns:** `getNarrativeRouter()`, `getTracer(sessionId)` for state management
|