Skip to main content
Glama
README.md
<div align="center">

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="docs/images/logo-dark.svg">
  <img alt="IntentOS" src="docs/images/logo-light.svg" width="320">
</picture>

<br />

<h3><strong>Turn natural speech into aligned, versioned tasks for AI coding agents</strong></h3>

<p>1 local MCP · 0 execution hijacking · every turn traceable.</p>

<p>用自然语言直接与 AI 协作:对齐工程颗粒度、锁住改动边界、跨 Agent 沉淀个人偏好。</p>

<p>
  <strong><a href="#核心特点与优势">核心优势</a></strong> &nbsp;·&nbsp;
  <strong><a href="#个人框架与偏好">个人框架</a></strong> &nbsp;·&nbsp;
  <strong><a href="#实战案例">实战案例</a></strong> &nbsp;·&nbsp;
  <strong><a href="#快速开始">快速开始</a></strong> &nbsp;·&nbsp;
  <strong><a href="#mcp-工具">MCP 工具</a></strong>
</p>

<p>
  <a href="https://github.com/agertonganjacc698-ctrl/IntentOS/stargazers"><img src="https://img.shields.io/github/stars/agertonganjacc698-ctrl/IntentOS?style=flat&color=0f766e&label=Stars" alt="GitHub Stars"></a>
  <a href="https://github.com/agertonganjacc698-ctrl/IntentOS/releases/tag/v0.3.0"><img src="https://img.shields.io/github/v/release/agertonganjacc698-ctrl/IntentOS?style=flat&color=2563eb&label=Release" alt="Release"></a>
  <a href="pyproject.toml"><img src="https://img.shields.io/badge/Python-3.11%2B-3776ab?style=flat" alt="Python 3.11+"></a>
  <a href="integrations/mcp/README.md"><img src="https://img.shields.io/badge/MCP-11%20Tools-0f766e?style=flat" alt="MCP 11 Tools"></a>
  <a href="#边界"><img src="https://img.shields.io/badge/Storage-Local%20SQLite-475569?style=flat" alt="Local SQLite"></a>
  <a href="LICENSE"><img src="https://img.shields.io/badge/License-Apache--2.0%20with%20conditions-d97706?style=flat" alt="License: Apache-2.0 with conditions"></a>
</p>

<p>
  <a href="https://github.com/agertonganjacc698-ctrl/IntentOS/releases/download/v0.3.0/IntentOS-MCP-0.3.0.zip"><img src="https://img.shields.io/badge/DOWNLOAD_v0.3.0-0F766E?style=for-the-badge&logo=github&logoColor=white" alt="Download v0.3.0"></a>
  <a href="integrations/mcp/README.md"><img src="https://img.shields.io/badge/MCP_SETUP_GUIDE-1E293B?style=for-the-badge&logo=modelcontextprotocol&logoColor=white" alt="MCP Setup Guide"></a>
  <a href="#快速开始"><img src="https://img.shields.io/badge/CLI_%26_OPENAPI-2563EB?style=for-the-badge&logo=fastapi&logoColor=white" alt="CLI and OpenAPI"></a>
</p>

<p><em>⭐ If IntentOS helps keep your AI coding sessions on track, consider starring this repo.</em></p>

</div>

<br />

![IntentOS Workflow](integrations/mcp/assets/workflow-v2.webp)

---

## 概览

在 **Codex、Claude Code、Cursor、DSH** 或自研 Agent 中照常用自然语言提需求,**IntentOS** 位于你和 Agent 之间,负责三件事:

1. **需求颗粒度对齐**:把宽泛口语拆成可追溯原话的任务与边界;有关键歧义时先用非技术语言确认,避免交付降级、把举例写死成规则或擅自扩写。
2. **工程护栏与上下文管理**:按小步推进、守住红线、隔离“顺便优化”的代码漂移、防止假修复;对话变长后直接用极简交接包开新会话续接。
3. **个人框架与偏好沉淀**:内置渐进式技术栈蓝图,并将经你确认的习惯存在本机 SQLite,本机不同 AI 工具间直接复用。

> IntentOS 不替代现有 Agent,也不接管文件与命令执行权;所有记录仅保存在本机。

---

## 核心特点与优势

- **用大白话提需求,不用懂技术术语**
  需求没说清时,AI 会用日常语言先问 1 个关键问题并给出推荐方案,而不是抛出一堆技术名词考你,也不会随手交付难以扩展的简化版本。
- **改口不跑偏,红线不越界**
  一句话里混着“现在要做、别动某处、顺便想想、以后再说”,系统自动拆清并绑定原话;顺带提的想法会被隔离在待确认区,避免 AI 借机大改无关文件。
- **敢于提出更好方案,防止叠补丁与被动重构**
  不盲目顺从有缺陷或治标不治本的做法;当发现用户思路遗漏关键风险、存在明显更简洁根治的替代方案,或同一任务正在层层叠补丁使结构变重时,先简要对比代价与更优方案供你拍板。
- **稳住工程节奏,防假修复、主动补盲区与防上下文失忆**
  修报错时要求先找根因并验证,防止敷衍掩盖问题;遇到公开发布、上线部署、接敏感数据等关键节点,AI 会先静默巡检项目并主动提醒你遗漏的隐私、协议或安全缺口(平时小改动零打扰);对话变长或新开会话时,直接读取交接包就能拿到最新待办、有效红线和验收标准。
- **自带渐进式蓝图,越用越懂你的习惯**
  不知道怎么搭架构时,可按阶段启用技术栈蓝图(先跑通核心,用到再加组件);你确认过的偏好存在本机,本机切换不同 AI 工具照样生效,改口时旧规则自动作废不冲突。
- **不绑定工具,不接管权限,数据全在本机**
  通过标准 MCP、Skill、CLI 与 HTTP 接入 Codex、Claude Code、Cursor、DSH 或自研 Agent;所有代码读写与命令执行仍在你的原工具和授权下完成,数据仅存本机 SQLite。

---

## 对比

| 场景 | 直接对话 / 常规提示词扩写 | IntentOS v0.3.0 |
| --- | --- | --- |
| 宽泛或对标式需求(*做个前端 / 类似小红书 / 接个支付*) | 易降级为一次性玩具实现,或盲猜技术栈 | 清晰度门禁 + 四维对齐:非技术语言确认工程形态与首版不做清单,附渐进默认方案 |
| 交流误差(举例当死规则 / 过度注释与营销腔) | 把“比如 A”写死成全部规则;堆满次级标签与浮夸口吻 | 提炼举例背后的通用原则;靠结构与层级自明,克制直接 |
| 单句混杂边界与“顺便优化” | 借“顺便”大改无关文件,破坏既有逻辑 | 拆分为 **Now / Boundary / Pending / Later**,“顺便项”自动隔离 |
| 报错修复(*报错了,修复它*) | 易用空 `try/catch`、`@ts-ignore` 或硬编码特例敷衍 | 自动注入反假修复护栏:先定位根因、禁止吞错与特例、须附实测证据 |
| 高破坏半径操作(迁移 / 批量重构 / 直接上线) | 终端 Agent 直接改动环境,难以回滚 | 未确认计划前先拦截,输出影响范围后再执行 |
| 多轮改口与长会话上下文腐烂 | 遗忘红线、新旧需求冲突、旧交付冒充新版通过 | 原子基线(`v1 → v2`)+ 新会话拉取 `project_handoff` 干净续接 |
| 本机切换不同 AI 工具 | 各工具记忆不互通,且旧偏好易冲突 | 本地 SQLite 偏好状态机(`proposed → active → superseded / revoked`),跨 MCP Agent 共享 |

---

## 核心能力

![核心能力全景](docs/images/capability-mindmap-v3.webp)

---

## 个人框架与偏好

![渐进式技术栈蓝图与偏好进化环](docs/images/blueprint-and-loop-v3.webp)

内置 3 套可选渐进式蓝图(`indie_saas`、`web_app`、`local_service`),不强绑定,按阶段解锁;以 `indie_saas` 为例:

| 阶段 | 组件 | 启用时机 |
| --- | --- | --- |
| **Stage 0 · MVP** | GitHub · Codex / Claude Code / Cursor · Vercel · Supabase | 首版跑通 1 个核心闭环 |
| **Stage 1 · 商业化** | Clerk / Supabase Auth · Stripe · Resend · Upstash Redis · Namecheap + Cloudflare DNS | 需要登录、收费、防刷或自定义域名 |
| **Stage 2 · 增长运维** | Supabase `pgvector` → Pinecone · PostHog · Sentry | 有真实流量与线上反馈 |

- **偏好进化环**:`profile_read(scan_candidates=True)` 从历史澄清与纠偏提取带出处候选,经确认才生效;分 `global` 与 `project:<id>`,改口时旧规自动标为 `superseded`,并自动注入后续 `dispatch` 与 `project_handoff`。
- **上下文与工程自检**:`project_handoff` 附带 `context_hygiene` 支持新会话干净续接;`review_guide` 提供 14 套纯只读按需审查方法(含 `engineering_hygiene`、`diagnosis`、`prototype` 等),简单任务零开销跳过。

---

## 实战案例

以线上导出接口 `/api/export` 的三轮迭代为例:

### Round 1 · 拆解边界

![Intent Decomposition](docs/images/intent-decomposition-v2.webp)

```text
v1  任务交接
  U1.1  当前优先项 · 先把 /api/export 加上每分钟限流
  U1.2  限制       · 别动现有的登录鉴权逻辑
  U1.3  待讨论     · 要不要顺便把错误码统一重构一下
  U1.4  延期项     · Redis 集群支持下个版本再做
```

### Round 2 · 智能路由

| 输入与上下文 | 路由 | 动作 |
| --- | --- | --- |
| 宽泛许愿、缺少唯一指代(如「改成 60」)或高破坏半径操作 | `translate → ask` | 拦截执行,返回 1 个非技术澄清问题与默认工程建议 |
| 夹带边界/“顺便优化”、含“比如/例如”举例、报错修复或可读性优化 | `translate` | 输出带原话出处与护栏的结构化任务包 |
| 前文已明确对象与参数,或已由生效偏好覆盖 | `direct` | 零开销放行,附带必要前文与生效偏好 |

### Round 3 · 变更与交接

> 「单机限流先停掉,这版直接做租户级配额;不动登录鉴权照旧。」

![项目变更流程](docs/images/change-workflow-v2.webp)

- 原 `rate-limit` 标为 `stop`,新增 `tenant-quota` 与新版验收,红线 `U1.2` 自动延续至 `v2`。
- 新会话读取 `project_handoff` 仅加载当前待办、红线、生效偏好与验收;旧版迟交按原版本留存,验收严格区分 `true` / `false` / `null`。

---

## 系统交互架构

![系统交互架构](docs/images/interaction-sequence-v2.webp)

---

## 快速开始

### MCP + Skill

1. 安装 [uv](https://docs.astral.sh/uv/getting-started/installation/),下载并解压 [IntentOS-MCP-0.3.0.zip](https://github.com/agertonganjacc698-ctrl/IntentOS/releases/download/v0.3.0/IntentOS-MCP-0.3.0.zip):

```sh
uv tool install --python 3.12 ./intentos_mcp-0.3.0-py3-none-any.whl
uv tool dir --bin
```

2. 在 Agent 中配置本地 `stdio` 服务(支持 Skill 的宿主一并加载包内 `skills/intentos/SKILL.md`):

```json
{
  "mcpServers": {
    "intentos": {
      "command": "/absolute/path/to/intentos-mcp",
      "args": []
    }
  }
}
```

<details>
<summary>Codex CLI · DSH · 自定义数据库路径</summary>

```sh
# Codex CLI(macOS / Linux)
codex mcp add intentos -- "$(uv tool dir --bin)/intentos-mcp"

# DSH(不修改日常 profile)
PATH="$(uv tool dir --bin):$PATH" dsh --profile headless --patch ./dsh.patch.yml '请列出 IntentOS 可用的工具'
```

```json
{
  "mcpServers": {
    "intentos": {
      "command": "/absolute/path/to/intentos-mcp",
      "args": [],
      "env": { "INTENTOS_DB": "/absolute/path/to/project.sqlite3" }
    }
  }
}
```

Windows 与详细步骤见 [integrations/mcp/README.md](integrations/mcp/README.md)。

</details>

3. 新开会话验证:

> 请用 IntentOS 整理这条需求,先给我任务清单,别动代码。先把 /api/export 加上每分钟限流,别动现有的登录鉴权逻辑。要不要顺便把错误码统一重构一下?Redis 集群支持下个版本再做。

### CLI & HTTP

```sh
uv sync --frozen

# 蓝图与偏好
uv run intentos profile blueprints indie_saas
uv run intentos profile adopt indie_saas
uv run intentos profile scan

# 路由、转译与审查清单
uv run intentos translate \
  '先把 /api/export 加上每分钟限流,别动现有的登录鉴权逻辑。要不要顺便把错误码统一重构一下?Redis 集群支持下个版本再做。' \
  --contains '限流'
uv run intentos dispatch '改成 60' \
  --history '把 /api/export 限流阈值设成 100' \
  --context '上次改的是 /api/export 每分钟最大请求数。' \
  --engine local --json
uv run intentos review engineering_hygiene

# 本地 OpenAPI 服务(http://127.0.0.1:8765/docs)
uv run intentos serve --port 8765
```

<details>
<summary>更多 CLI 命令与模型引擎配置</summary>

```sh
uv run intentos show ID
uv run intentos handoff ID
uv run intentos diff ID
uv run intentos verify ID --revision 1 --file delivery.txt

# OpenAI 兼容 /chat/completions 端点
INTENTOS_BASE_URL="https://your-endpoint/v1" INTENTOS_MODEL="your-model" INTENTOS_API_KEY="your-key" \
uv run intentos translate '先把 /api/export 加上每分钟限流,别动现有的登录鉴权逻辑。' --engine model

# 本机已登录的 Codex CLI
INTENTOS_MODEL_PROVIDER=codex INTENTOS_MODEL="your-codex-model" \
uv run intentos translate '先把 /api/export 加上每分钟限流,Redis 集群以后再说。' --engine model
```

</details>

---

## MCP 工具

| Tool | Access | 职责 |
| --- | --- | --- |
| `dispatch` | Write | 单轮路由(自动注入生效偏好),返回 `ready`、`needs_reading` 或 `awaiting_user` |
| `profile_read` | Read-only | 读取生效偏好、待确认提案、渐进式蓝图与历史摩擦候选 |
| `profile_update` | Write | 经确认提议、激活/替代、作废偏好规则或采纳蓝图 |
| `review_guide` | Read-only | 按需读取 14 套审查清单(含 `engineering_hygiene`、`diagnosis`、`prototype` 等) |
| `project_start` | Write | 登记已确认意图、任务、原话出处与验收基线(`v1`) |
| `project_prepare` | Read-only | 基于当前基线与可见材料生成变更影响分析输入 |
| `project_change` | Write | 原子升级版本并逐项标记 `continue / modify / stop` 与新版验收 |
| `project_handoff` | Read-only | 返回当前待办、红线、生效偏好、最新验收与 `context_hygiene` |
| `project_version` | Read-only | 查看最新版或历史版本号快照 |
| `project_delivery` | Write | 按原版本号记录实际交付与逐项证据(`true` / `false` / `null`) |
| `project_deliveries` | Read-only | 查看全部交付与证据历史(含旧版迟交) |

---

## 边界

- **Local-first**:数据保存在本机 SQLite(MCP 默认 `~/.intentos/mcp.sqlite3`,CLI 默认 `.intentos/workspace.sqlite3`)。
- **Zero Execution Authority**:不读写业务代码、不执行命令,权限与最终确认归属宿主与用户。
- **No Silent Drift**:未确认想法不改基线,未确认偏好不生效,未验证验收项保持 `null`。

---

## 许可协议

本项目采用 **[Apache-2.0 with Additional Conditions](LICENSE)**:个人学习、研究及组织内部研发工作流免费使用;未经书面商业授权,禁止将本项目及其衍生作品包装为付费商业产品或面向第三方提供收费托管 SaaS / MCP / API 服务,且不得移除版权与协议声明。