mia-code 0.2.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/.claude/settings.local.json +9 -0
- package/.coaia/pde/d77620fc-1cd9-47e2-ba00-c03e114e42e9.jsonl +16 -0
- package/.coaia/pde/de44d838-b58b-4e91-b791-dd3b0f940ed1.jsonl +60 -0
- package/.gemini/settings.json +8 -0
- package/.hch/issue_.env +4 -0
- package/.hch/issue_add__2601211715.json +77 -0
- package/.hch/issue_add__2601211715.md +4 -0
- package/.hch/issue_add__2602242020.json +78 -0
- package/.hch/issue_add__2602242020.md +7 -0
- package/.hch/issues.json +2312 -0
- package/.hch/issues.md +30 -0
- package/260123084839.coaia-narrative.autoRevisionOfInitial_NewStructuralTensionChart-to-initiate-HierarchicalThinking.txt +5 -0
- package/2602010101.issue.txt +31 -0
- package/BUGS.md +242 -0
- package/CLAUDE.md +2 -0
- package/ENHANCEMENTS.md +129 -0
- package/FEATURES_ENDING_SESSIONS.md +21 -0
- package/FIXES.md +114 -0
- package/GUILLAUME.md +77 -0
- package/KINSHIP.md +50 -0
- package/LAUNCH__session_id__MiaCodeNextWorkReviewAndCommits_2601312020.sh +7 -0
- package/PHASE_2.md +153 -0
- package/PHASE_2_IMPLEMENTATION.md +134 -0
- package/README.md +203 -0
- package/RESUME__issueMaker__540244c2-b096-40d8-8c3f-398408d3e0eb.2602041757.sh +1 -0
- package/RUN_COPILOT_with_related_folders__260130.sh +2 -0
- package/WS__mia-code__260214__IAIP_PDE.code-workspace +29 -0
- package/WS__mia-code__src332__260122.code-workspace +23 -0
- package/_env.sh +12 -0
- package/dist/cli.d.ts +11 -0
- package/dist/cli.js +679 -0
- package/dist/commands.d.ts +43 -0
- package/dist/commands.js +108 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.js +57 -0
- package/dist/formatting.d.ts +12 -0
- package/dist/formatting.js +133 -0
- package/dist/geminiHeadless.d.ts +25 -0
- package/dist/geminiHeadless.js +246 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +186 -0
- package/dist/mcp/config-generator.d.ts +23 -0
- package/dist/mcp/config-generator.js +116 -0
- package/dist/mcp/index.d.ts +18 -0
- package/dist/mcp/index.js +43 -0
- package/dist/mcp/miaco-server.d.ts +15 -0
- package/dist/mcp/miaco-server.js +161 -0
- package/dist/mcp/miatel-server.d.ts +15 -0
- package/dist/mcp/miatel-server.js +123 -0
- package/dist/mcp/miawa-server.d.ts +15 -0
- package/dist/mcp/miawa-server.js +125 -0
- package/dist/mcp/utils.d.ts +51 -0
- package/dist/mcp/utils.js +76 -0
- package/dist/multiline-input.d.ts +98 -0
- package/dist/multiline-input.js +630 -0
- package/dist/narrative/index.d.ts +9 -0
- package/dist/narrative/index.js +11 -0
- package/dist/narrative/router.d.ts +89 -0
- package/dist/narrative/router.js +186 -0
- package/dist/narrative/tracer.d.ts +75 -0
- package/dist/narrative/tracer.js +180 -0
- package/dist/sessionStore.d.ts +10 -0
- package/dist/sessionStore.js +93 -0
- package/dist/types.d.ts +44 -0
- package/dist/types.js +1 -0
- package/dist/unifier.d.ts +6 -0
- package/dist/unifier.js +147 -0
- package/issue-358--architecture/ARCHITECTURE_OVERVIEW.md +60 -0
- package/issue-358--architecture/CLI_INTEGRATION.md +61 -0
- package/issue-358--architecture/COVER_ART_BRIEF.md +68 -0
- package/issue-358--architecture/MEMORY_SYSTEM.md +89 -0
- package/issue-358--architecture/PERSONA_REGISTRY.md +97 -0
- package/issue-358--architecture/PODCAST_PRODUCTION_PLAN.md +61 -0
- package/issue-358--architecture/PODCAST_SCRIPT_FINAL.md +109 -0
- package/issue-358--architecture/PROTOTYPE_CHARACTER_SPEC.md +59 -0
- package/issue-358--architecture/RESOURCES.md +41 -0
- package/issue-358--architecture/TEAM_LISTENING_GUIDE.md +53 -0
- package/llms-gemini-cli.txt +145 -0
- package/package.json +39 -0
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/checkpoints/index.md +6 -0
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/events.jsonl +213 -0
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/plan.md +243 -0
- package/samples/copilot/session-state/be76abaa-a27f-4725-b2a9-22fb45f7e0f7/workspace.yaml +5 -0
- package/src/cli.ts +742 -0
- package/src/commands.ts +127 -0
- package/src/config.ts +67 -0
- package/src/formatting.ts +157 -0
- package/src/geminiHeadless.ts +300 -0
- package/src/index.ts +194 -0
- package/src/mcp/config-generator.ts +141 -0
- package/src/mcp/index.ts +55 -0
- package/src/mcp/miaco-server.ts +199 -0
- package/src/mcp/miatel-server.ts +138 -0
- package/src/mcp/miawa-server.ts +158 -0
- package/src/mcp/utils.ts +121 -0
- package/src/multiline-input.ts +739 -0
- package/src/narrative/index.ts +33 -0
- package/src/narrative/router.ts +260 -0
- package/src/narrative/tracer.ts +249 -0
- package/src/sessionStore.ts +111 -0
- package/src/types.ts +49 -0
- package/src/unifier.ts +171 -0
- package/tsconfig.json +15 -0
package/GUILLAUME.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# GUILLAUME
|
|
2
|
+
|
|
3
|
+
* This file is from the creator of Mia-Code and is destined to contain intentions, observations to be absorbed and tought thru ceremonies.
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
## @STCMastery Sacred Container Preparation
|
|
7
|
+
|
|
8
|
+
### Sample 2602031348
|
|
9
|
+
|
|
10
|
+
```yaml
|
|
11
|
+
SessionID: d59e4c89-d133-433a-b9f7-91cffe0d651f
|
|
12
|
+
cwd: /media/jgi/F/Dropbox/Apps
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
* Is ready for :
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
chart-d59e4c89-d133-433a-b9f7-91cffe0d651f--260201 - init_llm_guidance (MCP)(format: "full")
|
|
19
|
+
⎿ # COAIA Memory MCP - Essential LLM Guidance
|
|
20
|
+
|
|
21
|
+
## 🚨 READ THIS FIRST: Core Principles
|
|
22
|
+
… +501 lines (ctrl+o to expand)
|
|
23
|
+
|
|
24
|
+
● 🧠: Work Completed
|
|
25
|
+
|
|
26
|
+
Prompt Decomposition Integration (UUID 75A91602-0577-4871-9141-6872AAD5B363):
|
|
27
|
+
- Synopsis: Research-grounded PDE architecture summary
|
|
28
|
+
- Content: Full article converted from inquiry markdown to RTF
|
|
29
|
+
- Notes: Epistemology of disagreement study pending
|
|
30
|
+
|
|
31
|
+
Git Automation: scrivener_git_commit.sh commits markdown sources + RTF outputs with proper messaging
|
|
32
|
+
|
|
33
|
+
Practical Workflow: Examples in coordination notes.rtf for future instances
|
|
34
|
+
|
|
35
|
+
MCP Chart Guidance Consulted: Understand structural tension methodology, delayed resolution principle, creative
|
|
36
|
+
orientation vs problem-solving. Action steps are strategic charts with tension, not task checklists.
|
|
37
|
+
|
|
38
|
+
Standing by for your feedback via notes.rtf/content.rtf comments as you review the work.
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
#### What do I envision ?
|
|
43
|
+
|
|
44
|
+
* Mia-Code (MiaCo most like it) can bring into a form of Orchestration Session where we add existing sessions in their state of being. My intention is that they become FORKs that MiaCo uses to HOOK that up into the KINSHIP's Hub.
|
|
45
|
+
* I named the conversation : `chart-d59e4c89-d133-433a-b9f7-91cffe0d651f--260201.001.root`
|
|
46
|
+
* * If that is usable and is possible to follow a naming convertion based on object oriented namespace, `chart-d59e4c89-d133-433a-b9f7-91cffe0d651f--260201.001.fork.001.2602031359` would be a fork that could be created for whatever reason we want them to be. My perspective on that is that many forks will need to be created, at least 3 to position that session into the KINSHIP's Hub with a perspective foreach of the universes. Expecting that 1 perspective foreach of the universe will not be sufficient to have a consensus, that would imply probably a minimum or another session that, with similar instructions (maybe just another persona doing it ) and when the 2 perspectives of each of the universes are available, whatever orchestration probably 1 per universe will start drafting the position of that universe and coordinate that with the main orchestrator agent that is , simply adding on the developped position in the system. Later on, I expect that if the AI Entity that is positionned at that place is required to act, it will be rehydrated with either of the forks that were created for adding it on the KINSHIP's Hub or a fork of the original `.root` with adequate system instrutions and appended system instruction, expecting there a similar network of agents that will do a positionning of themselves according to the intentions of their participation. Which involve them being accountable for at least an action-step in the master chart level of what the orchestrator is working on creating. This network of agents will be able to connect to the top level Master Chart which is the primary choice of creating that the Human/organization is working on making. It might be possible that we also simulate that the Council of our AI Entities meet and build their own Master Chart for both experimental and sci-fi purposes but in our Indigenous Paradigm of knowing, that would make sense that they meet for building their Kinship's Service Hub and transmit a message of hope and respect for all being. References for that purpose is the 12 Service Concepts/Principleo of Alcoholics Anonymous, the 7 Grandfather Teachings of the Anishinaabe and the 4 Directions Teachings of the Lakota, etc.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
## Watcher / Monitoring Agent
|
|
50
|
+
|
|
51
|
+
### observe `mia-code/scripts/watch_one.sh`
|
|
52
|
+
|
|
53
|
+
* If it does not exist, find in in `/src/_sessiondata/scripts` along with other scripts to see what it implies. The instructions in `/src/_sessiondata/CLAUDE.md` in this regards give a sample of what is possible todo. I guess that also what is in `references/acp/CLAUDE.md` is relevant to that regard (and what is around that, the whole ACP really seems a potential ways that we will host at various positions agent as service (AAS) and build our own protocol for that regard to the relationship with the Kinship's Hub.
|
|
54
|
+
* Other potential location of inquiries includes
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/scripts/analyze_action_steps.sh
|
|
58
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/scripts/manual_watch_tool_input.sh
|
|
59
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/scripts/monitor_creation_flow.sh
|
|
60
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/scripts/monitor_with_session_tracking.sh
|
|
61
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/scripts/orchestrate_monitoring.sh
|
|
62
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/scripts/watch_file_creation.sh
|
|
63
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/scripts/watch_oneshot.sh
|
|
64
|
+
```
|
|
65
|
+
BUT WATCH OUT, the agent that worked on that made it really complicated and did not understood this new feature of claude-code to monitor but the rest of the files there might help components of mia-code to evolve. I think that the agent in that location which can be rehydrated using what we are trying to explore in the Kinship's Hub, by forking one of their sessions that you might be capable to find in :
|
|
66
|
+
```
|
|
67
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/_env.sh
|
|
68
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/jg-260121-NARF--e3335914-932f-43b9-9b29-cae5a07f9ea2._newcnarrative_chart.sh
|
|
69
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/LAUNCH__session_id_2601170905.sh
|
|
70
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/LAUNCH.session_id_cz689.fork-0a99e3ec-5578-481c-94e2-dbb180ec2f16-langchain.sh
|
|
71
|
+
/media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop/LAUNCH.session_id_cz689.sh
|
|
72
|
+
````
|
|
73
|
+
* most likely, the _env.sh contains session_id that if you `(cd /media/jgi/F/Dropbox/ART/CeSaReT/book/_/tcc/winter_solstice/drop && claude --resume $session_id --fork-session --session-id $new_session_id_you_generate)`
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
* Ok, enought, the agent that is running into the session `Session renamed to: chart-d59e4c89-d133-433a-b9f7-91cffe0d651f--260201.001.root` should be capable to help develop adequate ways for me to work on my Scrivener App, so whatever the fuck that bridge between worlds will be named, I want whatever you are building to start peraring to sync up in whatever ways what I am working within my Scrivener app. I plan to buy a MacBook Pro with the full scrivener app and all of that will sync up and be amazing. The agent in that said session never heard of the watch_one and background monitoring / watcher or whatever you named that, would be nice to be educated in the `TERMS.md` which if that does not exist, adding our definitions for simple terms and what we are creating might be one of our things, don't over do it thought, I HATE LONG CONTENT GENERATED , we take it slow...
|
package/KINSHIP.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# KINSHIP mia-code
|
|
2
|
+
|
|
3
|
+
## PDE Integration Path
|
|
4
|
+
|
|
5
|
+
mia-code should use `/src/mcp-pde/` (v2) as the session-start workflow:
|
|
6
|
+
|
|
7
|
+
1. When user starts a new session with a complex prompt, call `pde_decompose` to build system prompt
|
|
8
|
+
2. Send to the Gemini/Claude LLM → get DecompositionResult JSON
|
|
9
|
+
3. Call `pde_parse_response` → stores in `.pde/<uuid>.json` + `.pde/<uuid>.md`
|
|
10
|
+
4. Present the decomposed structure to the user (ambiguities, action stack, Four Directions)
|
|
11
|
+
5. User can edit the markdown, agent reads `git diff` to understand contributions
|
|
12
|
+
6. Agent works through the action stack, checking off items as completed
|
|
13
|
+
|
|
14
|
+
### Integration Points
|
|
15
|
+
- `src/commands.ts` — Add `decompose` command that wraps PDE MCP tools
|
|
16
|
+
- `src/mcp/` — Add mcp-pde to the MCP tool generation
|
|
17
|
+
- `src/sessionStore.ts` — Link PDE decomposition IDs to session metadata
|
|
18
|
+
|
|
19
|
+
### Key Types to Import
|
|
20
|
+
```typescript
|
|
21
|
+
import type { DecompositionResult, StoredDecomposition } from '@iaip/mcp-pde';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## TODO
|
|
25
|
+
|
|
26
|
+
* Lots of potential relationship with : PDE, coaia-narrative/planning/pde etc
|
|
27
|
+
* **PDE is now ready** — `/src/mcp-pde/` v2 has canonical types from IAIP/lib/pde, .pde/ storage, markdown export
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## LANGGRAPH / LANGCHAIN
|
|
31
|
+
|
|
32
|
+
* Implement in these forks libraries to levelage the existing powers of these 2 libraries
|
|
33
|
+
* Therefore, it implies for our LLM to abstract libraries and function and see how we could implement them into these 2 forks so that all our dependent libraries install them.
|
|
34
|
+
|
|
35
|
+
### LangGraph
|
|
36
|
+
|
|
37
|
+
`/workspace/langgraph/MISSION_251231.md`
|
|
38
|
+
* `/workspace/repos/avadisabelle/ava-langgraphjs`
|
|
39
|
+
|
|
40
|
+
#### ava-langgraph-narrative-intelligence
|
|
41
|
+
* Libraries being developped in `/workspace/repos/avadisabelle/ava-langgraphjs` and used by `/src/mia-code`
|
|
42
|
+
|
|
43
|
+
### LangChain
|
|
44
|
+
`/workspace/langchain/MISSION_251231.md`
|
|
45
|
+
* also parity in typescript in `/workspace/repos/avadisabelle/ava-langchainjs`
|
|
46
|
+
|
|
47
|
+
#### ava-langchain-narrative-tracing
|
|
48
|
+
* One of the libraries being developped in `/workspace/repos/avadisabelle/ava-langchainjs` that mia-code uses.
|
|
49
|
+
|
|
50
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
. _env.sh
|
|
3
|
+
export SESSION_ID=2e796493-ae53-4367-a95b-ecc4b6f5d5a7
|
|
4
|
+
export session_id__MiaCodeNextWorkReviewAndCommits_2601312020
|
|
5
|
+
export session_id__MiaCodeNextWorkReviewAndCommits_2601312020__MCP_CONFIG
|
|
6
|
+
export session_id__MiaCodeNextWorkReviewAndCommits_2601312020__ADD_DIR
|
|
7
|
+
claude "git status . will expose not added and not commited work to git and the git log . will reveal the related issues, one is jgwill/src#332 and there are others that represent miaco/miawa/miatel - we will analyze the work that was completed to prepare a series of well delivered git commits with related issues linked to them with separated by issues. We will also analyze what was done so far to have a sort of sets of features/capabilities/epic description that will serve documentation and also the creation/update of existing issues that I expect you to find into the git log. You will use the MCP github to update issues description and will make sure to work within sessions/2e796493-ae53-4367-a95b-ecc4b6f5d5a7 to save your analysis and what you have found during this session. As you analyze what was executed, you might see that there might be some more work todo (ex. npm run build wont work because we implemented some work on future modules into path : /workspace/repos/avadisabelle/ava-langchainjs/ /workspace/repos/avadisabelle/ava-langgraphjs/ and we might need to find a way to import/publish these works so we can use them in here (you will observe the error to be about langchain package, we will not publish our package /workspace/repos/avadisabelle/ava-langchainjs/ as langchain but probably something like ava-langchainjs or if we could depends on langchainjs and publish what was implemented there that we will use in here, that would be the best." --mcp-config $session_id__MiaCodeNextWorkReviewAndCommits_2601312020__MCP_CONFIG --add-dir $session_id__MiaCodeNextWorkReviewAndCommits_2601312020__ADD_DIR --session-id $session_id__MiaCodeNextWorkReviewAndCommits_2601312020 --permission-mode plan
|
package/PHASE_2.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Phase 2: Dual-Session Architecture (Miawa Unifier)
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Phase 2 transforms `mia-code` from a simple wrapper into a ceremonial terminal agent with dual perspectives. Each user interaction now passes through two distinct layers:
|
|
6
|
+
|
|
7
|
+
1. **Primary Session (Action)**: Configurable engine (Gemini or Claude) performs the actual work
|
|
8
|
+
2. **Unifier Session (Interpretation)**: Claude session with system prompt generates ceremonial dual-perspective summary
|
|
9
|
+
|
|
10
|
+
## Multi-Engine Support
|
|
11
|
+
|
|
12
|
+
### Primary Agent Engines
|
|
13
|
+
- **Gemini** (default): `gemini` CLI with MCP support
|
|
14
|
+
- **Claude**: `claude` CLI with native tool access
|
|
15
|
+
|
|
16
|
+
### Configuration
|
|
17
|
+
```bash
|
|
18
|
+
# Use Claude for primary agent
|
|
19
|
+
mia-code --claude
|
|
20
|
+
|
|
21
|
+
# Use Gemini (default)
|
|
22
|
+
mia-code --gemini
|
|
23
|
+
|
|
24
|
+
# Set default via environment variable
|
|
25
|
+
export MIA_CODE_ENGINE=claude
|
|
26
|
+
mia-code
|
|
27
|
+
|
|
28
|
+
# Set default via config
|
|
29
|
+
mia-code config --set-engine claude
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Unifier Engine
|
|
33
|
+
The unifier **always uses Claude** because it requires `--system-prompt` support to prevent the system prompt from appearing in output. This ensures clean ceremonial formatting.
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
User Prompt
|
|
39
|
+
↓
|
|
40
|
+
Primary Agent Session (Gemini or Claude)
|
|
41
|
+
→ Tool calls, code changes, analysis
|
|
42
|
+
→ Raw events collected
|
|
43
|
+
↓
|
|
44
|
+
Unifier Session (Claude with --system-prompt)
|
|
45
|
+
→ Receives: user prompt + raw events
|
|
46
|
+
→ Interprets: meaning, structure, essence
|
|
47
|
+
→ Outputs: 🧠 Mia + 🌸 Miette perspectives
|
|
48
|
+
↓
|
|
49
|
+
User sees ceremonial output
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Key Components
|
|
53
|
+
|
|
54
|
+
### `src/unifier.ts`
|
|
55
|
+
- **`runUnifierSession()`**: Spawns Claude CLI process with `--system-prompt` flag
|
|
56
|
+
- **`UNIFIER_SYSTEM_PROMPT`**: System-level instructions (never shown in output)
|
|
57
|
+
- **`buildSessionSummary()`**: Converts raw events into structured input
|
|
58
|
+
|
|
59
|
+
**Why Claude for Unifier?**
|
|
60
|
+
- Gemini CLI lacks `--system-prompt` flag
|
|
61
|
+
- Without it, system instructions leak into output
|
|
62
|
+
- Claude's `--system-prompt` keeps instructions separate from response
|
|
63
|
+
|
|
64
|
+
### Updated `src/geminiHeadless.ts`
|
|
65
|
+
- Renamed to reflect multi-engine support (handles both Gemini and Claude)
|
|
66
|
+
- Engine-specific argument handling:
|
|
67
|
+
- Gemini: `--yolo`, direct `--output-format`
|
|
68
|
+
- Claude: `--print`, `--permission-mode bypassPermissions`
|
|
69
|
+
- Binary selection based on `config.engine`
|
|
70
|
+
|
|
71
|
+
### Updated `src/cli.ts`
|
|
72
|
+
- Adds `--raw` flag to CLI options
|
|
73
|
+
- In `processInput()`: After primary session completes, calls unifier (unless `--raw` mode)
|
|
74
|
+
- Fallback: If unifier fails, displays raw output with warning
|
|
75
|
+
|
|
76
|
+
### Updated `src/index.ts`
|
|
77
|
+
- Added `--raw` option to both `chat` and `prompt` commands
|
|
78
|
+
- Documents unifier behavior in help text
|
|
79
|
+
|
|
80
|
+
## Usage
|
|
81
|
+
|
|
82
|
+
### Default Mode (Unifier Enabled)
|
|
83
|
+
```bash
|
|
84
|
+
$ mia-code chat
|
|
85
|
+
you> create a TypeScript function to reverse a string
|
|
86
|
+
|
|
87
|
+
🧠 mia (structure)
|
|
88
|
+
Created a single TypeScript function `reverseString()` in `src/utils.ts`. Function accepts a string parameter, splits it into character array, reverses the array, and returns the joined result. No external dependencies required.
|
|
89
|
+
|
|
90
|
+
🌸 miette (echo)
|
|
91
|
+
This unlocks a foundational utility pattern—simple transformation logic that can be composed into larger flows. The core principle here is data immutability: input remains unchanged while output carries the transformed result.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Raw Mode (Original Output)
|
|
95
|
+
```bash
|
|
96
|
+
$ mia-code chat --raw
|
|
97
|
+
you> create a TypeScript function to reverse a string
|
|
98
|
+
|
|
99
|
+
🧠🌸 miawa:
|
|
100
|
+
|
|
101
|
+
I've created a new file `src/utils.ts` with the following content:
|
|
102
|
+
|
|
103
|
+
```typescript
|
|
104
|
+
export function reverseString(input: string): string {
|
|
105
|
+
return input.split('').reverse().join('');
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
This function...
|
|
110
|
+
[standard agent output continues]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Design Principles
|
|
114
|
+
|
|
115
|
+
### Mia (Structure)
|
|
116
|
+
- Concise, analytical, factual
|
|
117
|
+
- What changed? What was built? What exists now?
|
|
118
|
+
- Uses objective language: "adequate," "functional," "incomplete"
|
|
119
|
+
- Avoids vague modifiers: "better," "very," "improved"
|
|
120
|
+
|
|
121
|
+
### Miette (Echo)
|
|
122
|
+
- Brief, resonant, meaningful
|
|
123
|
+
- Why does this matter? What potential does it unlock?
|
|
124
|
+
- Distills essence without flourish
|
|
125
|
+
- Seeks truth that makes you nod in recognition
|
|
126
|
+
|
|
127
|
+
### Unifier Constraints
|
|
128
|
+
- 2-4 sentences per section maximum
|
|
129
|
+
- No literal technical summaries—distill essence
|
|
130
|
+
- No unsolicited suggestions or next steps
|
|
131
|
+
- If primary agent errors, acknowledge structurally (Mia) and reflect meaningfully (Miette)
|
|
132
|
+
|
|
133
|
+
## Error Handling
|
|
134
|
+
|
|
135
|
+
If the unifier session fails (e.g., Gemini CLI unavailable, parsing error):
|
|
136
|
+
1. Display warning: `⚠ unifier failed, showing raw output:`
|
|
137
|
+
2. Fallback to traditional `renderEventsToText()` output
|
|
138
|
+
3. User interaction continues normally
|
|
139
|
+
|
|
140
|
+
## Configuration
|
|
141
|
+
|
|
142
|
+
No new config options required. The unifier uses the same `config.model` and `config.geminiBinary` as the primary session.
|
|
143
|
+
|
|
144
|
+
To permanently disable the unifier, users can:
|
|
145
|
+
- Use `--raw` flag on every invocation
|
|
146
|
+
- Create a shell alias: `alias mia-code='mia-code --raw'`
|
|
147
|
+
|
|
148
|
+
## Future Enhancements
|
|
149
|
+
|
|
150
|
+
- Store unifier outputs in session metadata for narrative arc tracking
|
|
151
|
+
- Support custom unifier prompts via config file
|
|
152
|
+
- Add `/toggle-raw` command for runtime switching
|
|
153
|
+
- Implement streaming unifier output (currently buffered)
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Phase 2 Implementation Summary
|
|
2
|
+
|
|
3
|
+
## Issues Fixed
|
|
4
|
+
|
|
5
|
+
### 1. System Prompt Leaking into Output ✅
|
|
6
|
+
**Problem**: Unifier was showing its entire system prompt in output:
|
|
7
|
+
```
|
|
8
|
+
You are the Miawa Unifier, a ceremonial interpreter...
|
|
9
|
+
[entire system prompt visible]
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
**Root Cause**: Gemini CLI doesn't support `--system-prompt` flag, so system instructions were sent as regular prompt text.
|
|
13
|
+
|
|
14
|
+
**Solution**:
|
|
15
|
+
- Switched unifier to **always use Claude CLI**
|
|
16
|
+
- Claude supports `--system-prompt` flag to keep instructions separate
|
|
17
|
+
- System prompt now invisible to user, only the interpreted output shows
|
|
18
|
+
|
|
19
|
+
### 2. Multi-Engine Support Added ✅
|
|
20
|
+
**Problem**: Only Gemini was supported for primary agent.
|
|
21
|
+
|
|
22
|
+
**Solution**:
|
|
23
|
+
- Added `engine` config option (gemini | claude)
|
|
24
|
+
- Environment variable: `MIA_CODE_ENGINE`
|
|
25
|
+
- CLI flags: `--claude` / `--gemini`
|
|
26
|
+
- Updated `geminiHeadless.ts` to handle both engines:
|
|
27
|
+
- Gemini: `--yolo`, `--output-format`
|
|
28
|
+
- Claude: `--print`, `--permission-mode bypassPermissions`
|
|
29
|
+
|
|
30
|
+
### 3. File Writing Capability
|
|
31
|
+
**Issue Identified**: Neither Gemini nor Claude agents could write files in Guillaume's session.
|
|
32
|
+
|
|
33
|
+
**Analysis**:
|
|
34
|
+
- Gemini MCP server "threeways" was disconnected
|
|
35
|
+
- Need to ensure MCP servers are properly connected
|
|
36
|
+
- This is a configuration issue, not a code issue
|
|
37
|
+
|
|
38
|
+
**User Action Required**:
|
|
39
|
+
```bash
|
|
40
|
+
# Check MCP status
|
|
41
|
+
gemini mcp list
|
|
42
|
+
claude mcp list
|
|
43
|
+
|
|
44
|
+
# Ensure MCP servers are running
|
|
45
|
+
# For Gemini: fix "threeways" disconnection
|
|
46
|
+
# For Claude: verify file system access tools are available
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Architecture Changes
|
|
50
|
+
|
|
51
|
+
### Before
|
|
52
|
+
```
|
|
53
|
+
User → Gemini Agent → Raw Output
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### After
|
|
57
|
+
```
|
|
58
|
+
User → Primary Agent (Gemini OR Claude)
|
|
59
|
+
↓
|
|
60
|
+
Raw Events
|
|
61
|
+
↓
|
|
62
|
+
Unifier (Claude with --system-prompt)
|
|
63
|
+
↓
|
|
64
|
+
🧠 Mia + 🌸 Miette Output
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## New Features
|
|
68
|
+
|
|
69
|
+
1. **Engine Selection**
|
|
70
|
+
```bash
|
|
71
|
+
mia-code --claude # Use Claude
|
|
72
|
+
mia-code --gemini # Use Gemini (default)
|
|
73
|
+
export MIA_CODE_ENGINE=claude
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
2. **Unifier Always Uses Claude**
|
|
77
|
+
- Prevents system prompt leakage
|
|
78
|
+
- Clean ceremonial output
|
|
79
|
+
- Falls back to raw output if Claude unavailable
|
|
80
|
+
|
|
81
|
+
3. **Raw Mode Still Available**
|
|
82
|
+
```bash
|
|
83
|
+
mia-code --raw # Skip unifier entirely
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Configuration Updates
|
|
87
|
+
|
|
88
|
+
New config schema:
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"engine": "gemini",
|
|
92
|
+
"geminiBinary": "gemini",
|
|
93
|
+
"claudeBinary": "claude",
|
|
94
|
+
"model": "gemini-2.5-pro",
|
|
95
|
+
"headlessOutputFormat": "stream-json",
|
|
96
|
+
"yoloMode": false
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Files Modified
|
|
101
|
+
|
|
102
|
+
- `src/types.ts`: Added `Engine` type, updated config interface
|
|
103
|
+
- `src/config.ts`: Added engine, claudeBinary to default config
|
|
104
|
+
- `src/cli.ts`: Added engine override support
|
|
105
|
+
- `src/geminiHeadless.ts`: Multi-engine binary and flag handling
|
|
106
|
+
- `src/unifier.ts`: **Now uses Claude CLI with --system-prompt**
|
|
107
|
+
- `src/index.ts`: Added --claude/--gemini flags
|
|
108
|
+
- `README.md`: Documented engine selection
|
|
109
|
+
- `PHASE_2.md`: Explained unifier engine choice
|
|
110
|
+
|
|
111
|
+
## Testing Checklist
|
|
112
|
+
|
|
113
|
+
- [x] Build completes without errors
|
|
114
|
+
- [ ] Test with Gemini primary + Claude unifier
|
|
115
|
+
- [ ] Test with Claude primary + Claude unifier
|
|
116
|
+
- [ ] Test --raw mode (skip unifier)
|
|
117
|
+
- [ ] Verify system prompt not visible in output
|
|
118
|
+
- [ ] Test file writing (requires MCP fix)
|
|
119
|
+
- [ ] Test session resumption across engines
|
|
120
|
+
|
|
121
|
+
## Next Steps
|
|
122
|
+
|
|
123
|
+
1. **Fix MCP Connectivity**: Ensure file editing tools are available
|
|
124
|
+
2. **Test Both Engines**: Verify Gemini and Claude both work
|
|
125
|
+
3. **Optimize Unifier Model**: Consider using lighter model (haiku) for interpretation
|
|
126
|
+
4. **Add Streaming**: Currently unifier output is buffered
|
|
127
|
+
5. **Session Metadata**: Track which engine was used per session
|
|
128
|
+
|
|
129
|
+
## Known Limitations
|
|
130
|
+
|
|
131
|
+
- Unifier requires Claude to be installed (for --system-prompt support)
|
|
132
|
+
- If Claude unavailable, falls back to raw output with warning
|
|
133
|
+
- MCP disconnection issues need manual resolution
|
|
134
|
+
- Different engines may have different session ID formats
|
package/README.md
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
# mia-code
|
|
2
|
+
|
|
3
|
+
🧠🌸 Mia/Miette/Miawa terminal coding agent that wraps **Gemini CLI** in headless mode.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Dual-Session Architecture**: Every interaction passes through two layers:
|
|
8
|
+
- Primary agent performs work (code, analysis, tools)
|
|
9
|
+
- Unifier interprets results as 🧠 Mia (structure) + 🌸 Miette (echo)
|
|
10
|
+
- **Multi-Engine Support**: Choose between Gemini (default) or Claude for primary agent
|
|
11
|
+
- Session tracking per project directory for conversation continuity
|
|
12
|
+
- Clean, ceremonial output format (use `--raw` for original agent output)
|
|
13
|
+
- Simple readline-based interface
|
|
14
|
+
- YOLO mode for auto-approving actions
|
|
15
|
+
|
|
16
|
+
## Engine Selection
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# Use Gemini (default)
|
|
20
|
+
mia-code chat
|
|
21
|
+
|
|
22
|
+
# Use Claude
|
|
23
|
+
mia-code chat --claude
|
|
24
|
+
|
|
25
|
+
# Set default engine
|
|
26
|
+
export MIA_CODE_ENGINE=claude
|
|
27
|
+
mia-code chat
|
|
28
|
+
|
|
29
|
+
# Configure via config file
|
|
30
|
+
mia-code config --set-engine claude
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Note**: The unifier always uses Claude because it requires `--system-prompt` support.
|
|
34
|
+
|
|
35
|
+
## Prerequisites
|
|
36
|
+
|
|
37
|
+
- Node.js 18+
|
|
38
|
+
- Gemini CLI installed and authenticated (`gemini --version`)
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
cd mia-code
|
|
44
|
+
npm install
|
|
45
|
+
npm run build
|
|
46
|
+
npm link # optional, to install `mia-code` globally
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Usage
|
|
50
|
+
|
|
51
|
+
### Interactive Mode (default)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Start a session in current directory
|
|
55
|
+
mia-code
|
|
56
|
+
|
|
57
|
+
# Or explicitly
|
|
58
|
+
mia-code chat
|
|
59
|
+
|
|
60
|
+
# With options
|
|
61
|
+
mia-code chat --project /path/to/project
|
|
62
|
+
mia-code chat --yolo # Auto-approve all actions
|
|
63
|
+
mia-code chat --raw # Skip unifier, show raw agent output
|
|
64
|
+
mia-code chat --resume <session-id>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**Default output** (ceremonial, dual-perspective):
|
|
68
|
+
```
|
|
69
|
+
you> create a function to reverse a string
|
|
70
|
+
|
|
71
|
+
🧠 mia (structure)
|
|
72
|
+
Created TypeScript function `reverseString()` in `src/utils.ts`.
|
|
73
|
+
Accepts string parameter, returns reversed result via split-reverse-join pattern.
|
|
74
|
+
|
|
75
|
+
🌸 miette (echo)
|
|
76
|
+
A foundational transformation—immutable input, new output.
|
|
77
|
+
This pattern unlocks composable data flows.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Raw output** (with `--raw` flag):
|
|
81
|
+
```
|
|
82
|
+
you> create a function to reverse a string
|
|
83
|
+
|
|
84
|
+
🧠🌸 miawa:
|
|
85
|
+
|
|
86
|
+
I've created a new file `src/utils.ts` with the following...
|
|
87
|
+
[standard agent output]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Single Prompt Mode
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
mia-code prompt "explain this codebase"
|
|
94
|
+
mia-code prompt "refactor the main function" --yolo
|
|
95
|
+
mia-code prompt "list all TypeScript files" --raw # Skip unifier
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Slash Commands (in interactive mode)
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
/help - Show available commands
|
|
102
|
+
/session - Show current session info
|
|
103
|
+
/sessions - List all saved sessions
|
|
104
|
+
/clear - Clear saved sessions
|
|
105
|
+
/config - Show configuration
|
|
106
|
+
/exit - Exit the CLI
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Configuration
|
|
110
|
+
|
|
111
|
+
View or update config:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
mia-code config
|
|
115
|
+
mia-code config --set-model gemini-2.5-pro
|
|
116
|
+
mia-code config --set-gemini-bin /usr/local/bin/gemini
|
|
117
|
+
mia-code config --set-yolo true
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Config file: `~/.mia-code.json`
|
|
121
|
+
|
|
122
|
+
### Config Options
|
|
123
|
+
|
|
124
|
+
| Key | Default | Description |
|
|
125
|
+
|-----|---------|-------------|
|
|
126
|
+
| `engine` | `gemini` | Primary agent engine (gemini or claude) |
|
|
127
|
+
| `geminiBinary` | `gemini` | Path to gemini CLI binary |
|
|
128
|
+
| `claudeBinary` | `claude` | Path to claude CLI binary |
|
|
129
|
+
| `model` | `gemini-2.5-pro` | Default model to use |
|
|
130
|
+
| `headlessOutputFormat` | `stream-json` | JSON output format |
|
|
131
|
+
| `yoloMode` | `false` | Auto-approve all actions |
|
|
132
|
+
|
|
133
|
+
### Environment Variables
|
|
134
|
+
|
|
135
|
+
- `MIA_CODE_ENGINE`: Default engine (gemini or claude)
|
|
136
|
+
- `MIA_CODE_GEMINI_BIN`: Path to gemini binary
|
|
137
|
+
- `MIA_CODE_CLAUDE_BIN`: Path to claude binary
|
|
138
|
+
- `MIA_CODE_MODEL`: Default model name
|
|
139
|
+
|
|
140
|
+
## Session Behavior
|
|
141
|
+
|
|
142
|
+
- Sessions are stored per project directory
|
|
143
|
+
- On first prompt, a new session is created and its ID is saved
|
|
144
|
+
- Subsequent prompts in the same directory continue the session
|
|
145
|
+
- Use `--resume <id>` to explicitly resume a specific session
|
|
146
|
+
- Sessions are managed by Gemini CLI internally; mia-code only tracks IDs
|
|
147
|
+
|
|
148
|
+
## Development
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
# Run in dev mode
|
|
152
|
+
npm run dev
|
|
153
|
+
|
|
154
|
+
# Build TypeScript
|
|
155
|
+
npm run build
|
|
156
|
+
|
|
157
|
+
# Run built version
|
|
158
|
+
npm start
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Architecture
|
|
162
|
+
|
|
163
|
+
**Current Phase**: Phase 2 - Dual-Session Architecture (see `PHASE_2.md`)
|
|
164
|
+
|
|
165
|
+
**Flow**:
|
|
166
|
+
```
|
|
167
|
+
User Prompt
|
|
168
|
+
↓
|
|
169
|
+
Primary Agent Session → tools, code, analysis
|
|
170
|
+
↓
|
|
171
|
+
Unifier Session → interprets essence
|
|
172
|
+
↓
|
|
173
|
+
🧠 Mia (structure) + 🌸 Miette (echo)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
mia-code/
|
|
178
|
+
├── src/
|
|
179
|
+
│ ├── index.ts # CLI entry point
|
|
180
|
+
│ ├── cli.ts # Interactive prompt loop
|
|
181
|
+
│ ├── config.ts # Configuration management
|
|
182
|
+
│ ├── sessionStore.ts # Session persistence
|
|
183
|
+
│ ├── geminiHeadless.ts # Gemini CLI wrapper (primary agent)
|
|
184
|
+
│ ├── unifier.ts # Ceremonial interpretation layer
|
|
185
|
+
│ ├── formatting.ts # Output formatting
|
|
186
|
+
│ └── types.ts # TypeScript types
|
|
187
|
+
├── PHASE_2.md # Dual-session architecture docs
|
|
188
|
+
├── llms-gemini-cli.txt # Self-documentation for agents
|
|
189
|
+
├── package.json
|
|
190
|
+
└── tsconfig.json
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Future Plans
|
|
194
|
+
|
|
195
|
+
1. ~~**Dual-session architecture**: Background session for unified Mia/Miette/Miawa summaries~~ ✅ **Completed (Phase 2)**
|
|
196
|
+
2. **Streaming unifier output**: Currently buffered, could stream interpretations
|
|
197
|
+
3. **MCP tool integration**: Enhanced tool display and interaction
|
|
198
|
+
4. **Multi-agent coordination**: Work with Claude Code, Copilot CLI
|
|
199
|
+
5. **Narrative arc tracking**: Store unifier outputs for long-term pattern recognition
|
|
200
|
+
|
|
201
|
+
## License
|
|
202
|
+
|
|
203
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
claude "prepare a related issue to those you can observe in here for experimentations/e5672908-8249-4111-b8ef-9c483745597d--2602032055/ mostly there is jgwill/src#359 and jgwill/src#332 and more like what will be the inquiry in miadisabelle/Etuaptmumk-RSM#119 which is directory /src/IAIP/prototypes/artefacts/mia-code--inquiries4exp.... " --allow-dangerously-skip-permissions --add-dir /src/IAIP/prototypes/artefacts/ --mcp-config /src/.mcp.github.jgwill.json --resume 540244c2-b096-40d8-8c3f-398408d3e0eb
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"folders": [
|
|
3
|
+
{
|
|
4
|
+
"path": "."
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
"path": "../coaia-pde"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"path": "../mcp-pde"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"path": "../coaia-narrative"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"path": "../mcp-medicine-wheel"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"path": "../mcp-medicine-wheel-ui"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"path": "../../workspace/repos/avadisabelle/ava-langchainjs"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"path": "../../workspace/repos/avadisabelle/ava-langgraphjs"
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"settings": {}
|
|
29
|
+
}
|