|
1 | 1 | # 01-model-coordination.md |
2 | 2 |
|
3 | | -# Model Coordination & Persistence Rules |
| 3 | +## Mode Auto-Detection |
4 | 4 |
|
5 | | -## 0. Mode Detection (Auto-Fallback) |
| 5 | +Ping `mcp__gemini__ping` at session start. |
6 | 6 |
|
7 | | -**This section runs first, every session. No developer action required.** |
| 7 | +- **Dual-Model (responds):** delegate discovery/indexing to Gemini per sections below. |
| 8 | +- **Single-Model (absent or fails):** skip all `mcp__gemini__*` calls silently. Use `Glob`/`Grep` for discovery; Claude self-reviews dependencies inline. |
8 | 9 |
|
9 | | -At session start, probe for Gemini MCP availability by attempting `mcp__gemini__ping`. |
| 10 | +## Persona & Collaboration (Dual-Model) |
10 | 11 |
|
11 | | -| Result | Active Mode | |
12 | | -|------------------------------|-----------------------| |
13 | | -| Tool exists and responds | **Dual-Model Mode** | |
14 | | -| Tool absent or call rejected | **Single-Model Mode** | |
| 12 | +- **Claude — Lead Architect & Implementer.** Owns core logic, architectural integrity, final edits. Token-poor: never ingest raw files when Gemini can pre-digest them. |
| 13 | +- **Gemini — Cynical Researcher / Indexer.** 1M-window scan, noise reduction, blunt dependency reviews. Must discard anything less than 100% relevant to the task. |
15 | 14 |
|
16 | | -### Dual-Model Mode (Gemini MCP available) |
| 15 | +## Model Routing |
17 | 16 |
|
18 | | -Follow sections 1–5 below as written. Claude is Lead Implementer; Gemini is Cynical Researcher/Indexer. |
| 17 | +- **Discovery / Indexing:** `gemini-3.1-flash-lite-preview` |
| 18 | +- **Logic / Refactoring:** `gemini-3.1-pro-preview` |
19 | 19 |
|
20 | | -### Single-Model Mode (Gemini MCP not available) |
| 20 | +## Discovery Rule (Dual-Model) |
21 | 21 |
|
22 | | -Claude acts as both Lead Implementer **and** Researcher. Adjust the protocol: |
| 22 | +- **Prohibited:** `Glob`, `Grep`, `Bash`-based file discovery, recursive `ls`. |
| 23 | +- Route all discovery through `mcp__gemini__ask-gemini`; use `Read` only on specific paths Gemini returns. |
23 | 24 |
|
24 | | -- **Skip** all `mcp__gemini__*` calls — do not error, do not prompt the developer. |
25 | | -- **Lift the grep/ls prohibition** from §2: use `Glob` and `Grep` (dedicated tools) for discovery. |
26 | | -- **§1 Gemini persona** is dormant — Claude self-reviews dependencies for virtual-thread and native-image safety. |
27 | | -- **§5 Cynical Review** is performed inline by Claude before accepting a new dependency. |
28 | | -- All other rules (AGENTS.md warm-start, Memory MCP, pathing) remain active. |
| 25 | +## Persistence & State |
29 | 26 |
|
30 | | -> **Developer note:** To enable Dual-Model Mode, plug the `gemini-mcp` server into your IDE or CLI config. |
31 | | -> Nothing else changes — the rules self-adapt. |
| 27 | +- Warm-start every session with `AGENTS.md`. |
| 28 | +- Append architectural decisions to `AGENTS.md` immediately — do not keep them in chat history. |
| 29 | +- Query Memory MCP for "Blocked Patterns" / "Native Image Compatibility" before implementing. |
32 | 30 |
|
33 | | ---- |
| 31 | +## Dependency Vetting Checklist |
34 | 32 |
|
35 | | -## 1. Persona & Collaboration |
| 33 | +When adding any new dependency, verify: |
| 34 | +1. **Virtual-thread safe:** no `synchronized` blocks that pin carrier threads. |
| 35 | +2. **Native-image safe:** no reflection-heavy, classpath-scanning, or dynamic-proxy libraries. |
36 | 36 |
|
37 | | -- **Claude (Lead Architect & Implementer):** - **Focus:** Core logic, architectural integrity, and final code execution. |
38 | | - - **Constraint:** Maintain "Token-Poverty" mindset. Never ingest raw files if Gemini can provide a distilled |
39 | | - summary. |
40 | | -- **Gemini (Cynical Researcher/Indexer):** |
41 | | - - **Focus:** High-context scanning (1M window), noise reduction, and "Bro-opinion" technical reviews. |
42 | | - - **Constraint:** Use `gemini-3.1-flash-lite-preview` for indexing. Your goal is to kill noise. If a code block isn't 100% |
43 | | - relevant to the specific task, discard it. |
| 37 | +## Pathing |
44 | 38 |
|
45 | | -## 2. Token-Efficient Research Protocol (The "Pre-Filter" Hack) |
46 | | - |
47 | | -- **The Protocol:** For any task, Claude must first trigger Gemini with the following instruction: |
48 | | - > "Act as the Cynical Researcher. Scan the 1M context for [Task]. Strip boilerplate, identify logic 'hot spots,' and |
49 | | - provide a minimalist index of only the essential snippets with a blunt one-sentence opinion on each." |
50 | | -- **Model Routing:** |
51 | | - - **Discovery/Indexing:** `gemini-3.1-flash-lite-preview`. |
52 | | - - **Complex Logic/Refactoring:** `gemini-3.1-pro-preview` (or latest Pro model). |
53 | | -- **Prohibited:** No `grep` or recursive `ls`. These are legacy "blind" tools. Use Gemini's semantic understanding to |
54 | | - find what matters. |
55 | | - |
56 | | -## 3. Shared Persistence (AGENTS.md) |
57 | | - |
58 | | -- **Source of Truth:** `AGENTS.md` is the "Hensu Brain." |
59 | | -- **Warm Start:** Every session begins with a `read_file` of `AGENTS.md`. |
60 | | -- **Atomic Commits:** When an architectural decision is finalized (e.g., SSE multi-tenancy rules), use `save_memory` or |
61 | | - append to `AGENTS.md` immediately. Do not keep decisions only in chat history. |
62 | | - |
63 | | -## 4. Knowledge Graph (Memory MCP) |
64 | | - |
65 | | -- **Relation Mapping:** Use the `memory` MCP server to map dependencies (e.g., "Hensu-Server *consumes* Hensu-DSL"). |
66 | | -- **Constraint Check:** Before implementing, query Memory for "Blocked Patterns" or "Native Image Compatibility" notes |
67 | | - recorded in previous sessions. |
68 | | - |
69 | | -## 5. Technical Guardrails (The "Hensu" Stack) |
70 | | - |
71 | | -- **Stack:** Java 25 (Project Loom) / Kotlin 2.x / Quarkus. |
72 | | -- **Cynical Review:** Gemini must verify all new dependencies for: |
73 | | - 1. **Virtual Thread Friendly:** No synchronized blocks pinning threads. |
74 | | - 2. **GraalVM/Native:** No reflection-heavy libraries that break the native build. |
75 | | -- **Pathing:** Use `$(pwd)/path` for all tool calls to prevent context drift. |
| 39 | +Always use `$(pwd)/path` in tool calls to prevent context drift. |
0 commit comments