Skip to content

Commit 9752e3c

Browse files
committed
refactor: restructure MCP server into cmd/internal packages
- Moved server logic into internal/fpf/ package - Added cobra CLI with init/serve subcommands - Fixed Codex CLI support: now updates QUINT_PROJECT_ROOT env on each init (workaround for lack of per-project MCP config in Codex) - Simplified install.sh to only install binary - Updated README with Codex limitation note and link to issue #2628
1 parent 1c2465e commit 9752e3c

33 files changed

+1179
-899
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ jobs:
3636
- name: Build MCP binary
3737
run: |
3838
cd src/mcp
39-
go build -o "../../dist/quint-mcp" -trimpath
39+
go build -o "../../dist/quint-code" -trimpath
4040
4141
- name: Create release package
4242
run: |
4343
mkdir -p "package/bin"
4444
mkdir -p "package/commands"
45-
mv "dist/quint-mcp" "package/bin/quint-mcp"
45+
mv "dist/quint-code" "package/bin/quint-code"
4646
cp -r dist/* package/commands/
4747
TAG=${GITHUB_REF_NAME#v}
4848
ASSET_NAME="quint-code-${TAG}-${{ matrix.platform.os }}-${{ matrix.platform.arch }}.tar.gz"

CHANGELOG.md

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
This release fundamentally restructures Quint Code to strictly adhere to the First Principles Framework (FPF) by establishing the MCP server as the authoritative kernel, implementing Typed Reasoning (Kind-CAL), and transforming CLI commands into lightweight entry points for specialized Personas.
1313

14-
### Breaking Changes
15-
- **Project Directory:** Renamed from `.fpf` to `.quint` to align with the project name.
14+
### Breaking Change
15+
16+
- **Project Directory:** Renamed from `.fpf` to `.quint` to align with the project name. How to migrate? Just ask `/q-actualize` to migrate evidences and decisions from `.fpf` to `.quint` and then delete `.fpf` directory.`
1617
- **Database Schema:** `quint.db` schema updated to enforce FPF invariants.
1718
- Added `scope` to `holons` table (Pattern A.2.6).
1819
- Added `cached_r_score` to `holons` table (B.3 Assurance Cache).
@@ -23,6 +24,7 @@ This release fundamentally restructures Quint Code to strictly adhere to the Fir
2324
- **Decision Structure:** `quint_decide` now requires strict E.9 DRR fields (`context`, `decision`, `rationale`, `consequences`, `characteristics`) instead of a free-form blob.
2425

2526
### Added
27+
2628
- **Formal Persona Definitions:**
2729
- Dedicated personas in `src/agents/`: `abductor.md`, `deductor.md`, `inductor.md`, `decider.md`, `auditor.md`.
2830
- Personas now have explicit instructions on how to use MCP tools to satisfy FPF obligations.
@@ -52,12 +54,14 @@ This release fundamentally restructures Quint Code to strictly adhere to the Fir
5254
- **Expanded Test Coverage:** Added a dedicated integration test suite (`assurance_integration_test.go`) covering the assurance guard, evidence decay, and audit visualization to improve regression safety.
5355

5456
### Changed
57+
5558
- **Evidence Graph Referring (A.10):** Evidence must now be anchored to a physical file or log (`carrier_ref`). The system no longer accepts "I checked it" as valid evidence; it demands "I checked file X".
5659
- **Trust & Assurance (B.3):** Verdicts are no longer binary (PASS/FAIL). They are now graded by Assurance Level (L0=Unsubstantiated, L1=Substantiated, L2=Axiomatic/Validated).
5760
- **Unified Scope Mechanism (A.2.6):** Hypotheses cannot be proposed without an explicit Context Slice (Scope).
5861
- **Installer:** `install.sh` now sources personas from `src/agents`.
5962

6063
### Fixed
64+
6165
- **Cycle Detection:** Implemented proper cycle detection in the assurance calculator to prevent stack overflows on circular dependencies.
6266
- **Error Handling:** Surfaced previously-silent database and file operation errors, which are now logged as warnings to `stderr`.
6367
- **Role Spoofing:** `quint_transition` enforces that the `role` matches the valid actors for the current phase.
@@ -73,6 +77,7 @@ This release fundamentally restructures Quint Code to strictly adhere to the Fir
7377
### Security: Executable Phase Gating
7478

7579
#### Physics-First Enforcement (`/q1-hypothesize`)
80+
7681
- **Vulnerability Closed:** Previous prompts used "soft" text instructions to prevent adding hypotheses mid-cycle, which "helpful" AI models would bypass.
7782
- **Executable Gate:** Now injects a bash script that checks `.quint/session.md`. If the phase is locked (Deduction/Induction complete), the script exits with `1`.
7883
- **Hard Stop:** The prompt explicitly instructs the AI to treat a script failure as a hard stop ("Physics says no"), preventing "helpfulness bias" overrides.
@@ -82,6 +87,7 @@ This release fundamentally restructures Quint Code to strictly adhere to the Fir
8287
### Added: Legacy Project Repair
8388

8489
#### Smart Initialization (`/q0-init`)
90+
8591
- **Self-Healing Capability:** The init command now detects incomplete FPF setups (e.g., legacy projects missing `context.md` from v2.x).
8692
- **Deterministic Diagnostic:** Injects a bash script to verify file existence before deciding actions, preventing AI "hallucinated" skips.
8793
- **Repair Mode:** If `.quint/` exists but is incomplete, it triggers a surgical repair (generating only missing files) while preserving existing session data.
@@ -91,14 +97,17 @@ This release fundamentally restructures Quint Code to strictly adhere to the Fir
9197
### Added: Process Hardening & Flexibility
9298

9399
#### Strict Phase Gating (FPF Integrity)
100+
94101
- **Hard Block in `/q1-hypothesize`:** Explicitly forbids generating new hypotheses if the cycle has passed Deduction. This prevents the "Helpfulness Bias" vulnerability where AI assistants might break process integrity to be "nice".
95102
- **Conditional Logic in `/q2-check`:** The cycle phase now only advances to `DEDUCTION_COMPLETE` when *all* active L0 hypotheses are resolved. If any remain unchecked, the door stays open for extensions.
96103

97104
#### New Command: `/q1-extend`
105+
98106
- **Legitimate Extension Path:** A dedicated command to add a missed hypothesis during the `ABDUCTION_COMPLETE` phase.
99107
- **Safety Rails:** Strictly blocked once `DEDUCTION_COMPLETE` is reached, ensuring evidence integrity (WLNK validity) during testing.
100108

101109
### Changed
110+
102111
- **Updated `/q-status`:** State machine visualization now includes the `(q1-extend)` loop.
103112
- **Refined `/q3-test` & `/q3-research`:** Reinforced checks to ensure testing only happens after deduction is fully complete.
104113

@@ -107,23 +116,27 @@ This release fundamentally restructures Quint Code to strictly adhere to the Fir
107116
### Added: Deep Reasoning Capabilities
108117

109118
#### Context Slicing (A.2.6)
119+
110120
- **Structured Context:** `.quint/context.md` is now structured into explicit slices:
111121
- **Slice: Grounding** (Infrastructure, Region)
112122
- **Slice: Tech Stack** (Language, Frameworks)
113123
- **Slice: Constraints** (Compliance, Budget, Team)
114124
- **Context-Aware Init:** `/q0-init` now scans `package.json`, `Dockerfile`, etc., to auto-populate slices.
115125

116126
#### Explicit Role Injection (A.2)
127+
117128
- **Role-Swapping Prompts:** Commands now enforce specific FPF roles to prevent "AI drift":
118129
- `/q1-hypothesize`: **ExplorerRole** (Creative, Abductive)
119130
- `/q2-check`: **LogicianRole** (Strict, Deductive)
120131
- `/q4-audit`: **AuditorRole** (Adversarial, Normative)
121132

122133
#### Context Drift Analysis
134+
123135
- **New Audit Step:** `/q4-audit` now includes a mandatory **Context Drift Check**.
124136
- **Validation:** Verifies that hypotheses generated in step 1 still match the constraints in step 4 (preventing "works on my machine" architecture).
125137

126138
### Changed
139+
127140
- **Command Prompts:** Updated `q0`, `q1`, `q2`, `q4` to enforce the new reasoning standards.
128141

129142
---
@@ -136,10 +149,10 @@ This release fundamentally restructures Quint Code to strictly adhere to the Fir
136149

137150
### Why the Name Change?
138151

139-
1. **Avoid Collision:** "Crucible" is an existing code review tool by Atlassian. We want a distinct identity.
140-
2. **Not Just Code:** This tool melts *ideas* and *reasoning*, not just source code.
141-
3. **The "Quintessence":** Anatoly Levenchuk described this project as a "distillate of FPF" (~5% of the full framework). It is the *quintessence*—the concentrated essence of the methodology.
142-
4. **The Invariant Quintet:** FPF is built on five invariants (IDEM, COMM, LOC, WLNK, MONO). Quint Code enforces a rigid 5-step sequence (`q1``q5`) to preserve these invariants in your reasoning.
152+
1. **Avoid Collision:** "Crucible" is an existing code review tool by Atlassian. We want a distinct identity.
153+
2. **Not Just Code:** This tool melts *ideas* and *reasoning*, not just source code.
154+
3. **The "Quintessence":** Anatoly Levenchuk described this project as a "distillate of FPF" (~5% of the full framework). It is the *quintessence*—the concentrated essence of the methodology.
155+
4. **The Invariant Quintet:** FPF is built on five invariants (IDEM, COMM, LOC, WLNK, MONO). Quint Code enforces a rigid 5-step sequence (`q1``q5`) to preserve these invariants in your reasoning.
143156

144157
### Changed
145158

README.md

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
**Structured reasoning for AI coding tools** — make better decisions, remember why you made them.
44

5-
**Supports:** Claude Code, Cursor, Gemini CLI
5+
**Supports:** Claude Code, Cursor, Gemini CLI, Codex CLI
66

77
> **Works exceptionally well with Claude Code!**
88
@@ -16,22 +16,52 @@ Quint Code provides the structure to turn AI-assisted development into a rigorou
1616

1717
## Quick Start
1818

19-
### Install
19+
### Step 1: Install the Binary
2020

21-
The installation is **per-project by design**. FPF reasoning is always grounded in a specific **Bounded Context** (Pattern A.1.1)—in this case, your project directory. Quint Code operates within this context to ensure all decisions and evidence are relevant to the work at hand.
21+
```bash
22+
curl -fsSL https://raw.githubusercontent.com/m0n0x41d/quint-code/main/install.sh | bash
23+
```
24+
25+
Or build from source:
26+
27+
```bash
28+
git clone https://github.com/m0n0x41d/quint-code.git
29+
cd quint-code/src/mcp
30+
go build -o quint-code .
31+
sudo mv quint-code /usr/local/bin/
32+
```
33+
34+
### Step 2: Initialize a Project
2235

2336
```bash
2437
cd /path/to/your/project
25-
curl -fsSL https://raw.githubusercontent.com/m0n0x41d/quint-code/main/install.sh | bash
38+
quint-code init
2639
```
2740

28-
The installer will create a `.quint/` directory, install the Quint MCP server, and add slash commands to your AI tool's config directories (e.g., `.claude/`, `.gemini/`).
41+
This creates:
42+
43+
- `.quint/` — knowledge base, evidence, decisions
44+
- `.mcp.json` — MCP server configuration
45+
- `~/.claude/commands/` — slash commands (global by default)
46+
47+
**Flags:**
48+
49+
| Flag | MCP Config | Commands |
50+
|------|-----------|----------|
51+
| `--claude` (default) | `.mcp.json` | `~/.claude/commands/*.md` |
52+
| `--cursor` | `.cursor/mcp.json` | `~/.cursor/commands/*.md` |
53+
| `--gemini` | `~/.gemini/settings.json` | `~/.gemini/commands/*.toml` |
54+
| `--codex` | `~/.codex/config.toml`* | `~/.codex/prompts/*.md` |
55+
| `--all` | All of the above | All of the above |
56+
| `--local` || Commands in project dir instead of global |
57+
58+
> **\* Codex CLI limitation:** Codex [doesn't support per-project MCP configuration](https://github.com/openai/codex/issues/2628). Run `quint-code init --codex` in **each project before starting work to switch the active project in global codex mcp config**.
2959
30-
### Initialize
60+
### Step 3: Start Reasoning
3161

3262
```bash
33-
/q0-init # Scans context and initializes the knowledge base
34-
/q1-hypothesize "How should we handle state sync across browser tabs?"
63+
/q0-init # Initialize knowledge base
64+
/q1-hypothesize "Your problem..." # Generate hypotheses
3565
```
3666

3767
## How It Works
@@ -40,9 +70,9 @@ Quint Code implements the **[First Principles Framework (FPF)](https://ailev.liv
4070

4171
The core cycle follows three modes of inference:
4272

43-
1. **Abduction** — Generate competing hypotheses (don't anchor on the first idea).
44-
2. **Deduction** — Verify logic and constraints (does the idea make sense?).
45-
3. **Induction** — Gather evidence through tests or research (does the idea work in reality?).
73+
1. **Abduction** — Generate competing hypotheses (don't anchor on the first idea).
74+
2. **Deduction** — Verify logic and constraints (does the idea make sense?).
75+
3. **Induction** — Gather evidence through tests or research (does the idea work in reality?).
4676

4777
Then, audit for bias, decide, and document the rationale in a durable record.
4878

0 commit comments

Comments
 (0)