peterdsp/kujto

GitHub: peterdsp/kujto

Kujto 为 AI 编程助手提供本地版本化记忆层,将仓库中的架构规则、风险标签和历史决策统一索引,让 agent 在修改文件前自动获取相关上下文。

Stars: 0 | Forks: 0

Kujto Studio # Kujto Studio ### 本地记忆层,防止 AI agent 和开发者破坏您的代码库规则。 在您修改文件之前,读取您仓库的记忆,然后显示适用的规则。 架构、风险、相关测试以及要注入的 agent 上下文,全部集中在一个面板中。 [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE) [![macOS 14+](https://img.shields.io/badge/macOS-14%2B-blue?logo=apple)](https://www.apple.com/macos/) [![Swift 6.2](https://img.shields.io/badge/Swift-6.2-orange?logo=swift)](https://swift.org/) [![Tests](https://img.shields.io/badge/tests-45%20passing-brightgreen)](https://github.com/peterdsp/kujto/actions) [![Site](https://img.shields.io/badge/Site-kujto.peterdsp.dev-black)](https://kujto.peterdsp.dev) [![Stars](https://img.shields.io/github/stars/peterdsp/kujto?style=social)](https://github.com/peterdsp/kujto/stargazers) [产品](#product) · [安装](#install) · [CLI](#cli) · [记忆格式](#memory-format) · [开发](#development) · [路线图](#roadmap)
## 产品 每个仓库都有隐藏的规则。新 agent 会忘记它们。新开发者会错过它们。旧有的决策存在于 PR、README 文件、Slack 线程、`AGENTS.md`、`CLAUDE.md` 以及十几个散落的文档中。Kujto Studio 会扫描这些繁杂的内容,并将其转化为一个活生生的记忆地图。 **核心界面并不是一个聊天框。** 你只需选中 `HomeReducer.swift` 或 `CheckoutFeature.swift`,Kujto Studio 就会显示: - 适用的架构规则,按 glob 匹配的精确度排序 - 风险标签(支付、认证、新手引导)、需要运行的测试以及相关模块 - 一份**置信度判定**:安全、需要上下文或危险区域 - 只需点击一下,即可将 agent 上下文注入到 Claude、Codex 或 Cursor 中 **四种界面,同一个引擎。** 相同的记忆索引驱动以下所有内容: | 界面 | 状态 | | --- | --- | | **独立 Mac 应用** (SwiftUI) | 可构建;已发布首次运行向导 + 设置 + 状态检测 | | **Xcode Source Editor 扩展** | 可构建;`Editor > Kujto > Show Rules for This File` | | **VS Code / Cursor 扩展** | [`integrations/vscode/`](integrations/vscode/),发布到 Marketplace | | **`kujto` CLI** | 今日发布;包含六个记忆命令(见下文) | 仅限本地索引。任何数据都不会离开你的机器。 ## 安装 目前 CLI 是最快的途径。Mac 应用可以从源码构建;给仓库加星即可加入 beta 测试。 ### CLI,一行命令 ``` curl -fsSL https://raw.githubusercontent.com/peterdsp/kujto/main/bin/install.sh | bash ``` 这会通过 symlink 将 Kujto 的 `AGENTS.md` 连接到每个受支持 agent 的主目录(`~/.claude/CLAUDE.md`、`~/.codex/AGENTS.md`、`~/.gemini/GEMINI.md` 等)中。没有重复。 ### Mac 应用,从源码构建 需要 Xcode 15+ 和 [XcodeGen](https://github.com/yonaskolb/XcodeGen)。 ``` git clone https://github.com/peterdsp/kujto.git cd kujto/integrations/xcode-extension xcodegen generate open KujtoStudio.xcodeproj ``` 在 Xcode 中,为 `KujtoStudio` app target 和 `KujtoRulesExtension` target 在 `Signing & Capabilities` 中选择你的 Team,然后运行。首次启动会显示一个四步欢迎向导,用于检测 CLI、Xcode 扩展以及任何已安装的 VS Code 或 Cursor 扩展。 ### VS Code 和 Cursor VS Code 扩展可以在包括 Cursor 在内的每个 VS Code 分支中运行。在 [`integrations/vscode/`](integrations/vscode/) 中,使用 `npx vsce package` 打包或使用 `npx vsce publish` 发布。 ## CLI 六个记忆命令,加上最初的 wire/unwire 界面。每个命令都支持 `--json` 以输出机器可读的 NDJSON。 ``` kujto rules App/Sources/Home/HomeReducer.swift # > TCA (The Composable Architecture) # memory/domains/ios/architectures/tca.md (匹配 **/*Reducer.swift) kujto map # Memory map: /path/to/repo # AGENTS.md: 是 MEMORY.md: 是 # memory 文件: 41 skills: 3 # scoped rules (4): TCA, Navigation, Snapshot testing, Prototyping # base memory (40 个文件,每次会话读取) kujto lint # ! [warning] memory/domains/ios/architectures/tca.md: applies_to glob # **/*Reducer.swift 在 repo 中未匹配到任何文件。 (unmatched_glob) kujto agents # ! AGENTS.md: 外部 # ✓ CLAUDE.md: 已链接 -> AGENTS.md # ✓ CODEX.md: 已链接 -> AGENTS.md # ✓ GEMINI.md: 已链接 -> AGENTS.md ``` 完整命令列表: | 命令 | 作用 | | --- | --- | | `kujto rules ` | 适用于某个文件的规则,按 glob 精确度排序 | | `kujto map` | 记忆地图:作用域规则、基础记忆、风险标签 | | `kujto lint` | 缺失的治理文件、未匹配的 glob、损坏的 `[[wiki]]` 链接 | | `kujto agents` | 每个 agent 的 wire 状态(`linked`、`foreign`、`not_present`) | | `kujto wire` / `kujto unwire` | Symlink 或移除 `AGENTS.md`/`CLAUDE.md`/`CODEX.md`/`GEMINI.md` | | `kujto root` | 打印 Kujto 安装根目录 | | `kujto context` | 检查当前的 Xcode workspace/scheme | | `kujto build` / `run` / `test` / `logs` / `clean` | Xcode 工具链编排器(NDJSON 事件) | | `kujto simulator` / `device` / `ui` | 模拟器控制、设备安装、UI 自动化 | ## 记忆格式 Kujto Studio 的基石是**文件作用域规则**。记忆和技能文件带有 frontmatter,用于将它们映射到源代码路径: ``` --- applies_to: - "**/*Reducer.swift" - "**/Checkout*/**" risk: payment --- # TCA 架构 Effects must be cancellable on `onDisappear`. Never mutate state from a view. Payment reducers need a shadow log entry: see [[payment_audit_log]]. ``` 没有 `applies_to` 的规则是**基础记忆**,每次会话都会读取(`MEMORY.md` 索引、写作风格、安全规则)。带有 `applies_to` 的规则是**带作用域的**:它们只会在检查匹配文件时出现。指向其他记忆文件的 `[[wiki_link]]` 引用会通过 `kujto lint` 进行验证。 ### 仓库布局 ``` Sources/ KujtoCore/ RuleIndex, MemoryMap, MemoryLinter, AgentExport, Wire KujtoCLI/ Command definitions for the kujto binary Tests/ KujtoCoreTests/ 45 tests covering the entire engine memory/ MEMORY.md the index; read after AGENTS.md core/ writing style, safety, git, handoff domains/ios/ Swift, TCA, snapshots, navigation, 12 architecture guides domains/web/ Mburoja: full web-security playbook (XSS, CSRF, SSRF, JWT, ...) workflows/ answer order, PR descriptions, git hygiene skills/ named procedures (prototyping loop, Mburoja audit, ...) integrations/ xcode-extension/ the Mac app, the Source Editor extension, the shared bridge vscode/ the VS Code / Cursor extension claude/ codex/ gemini/ copilot/ cursor/ per-agent wiring adapters site/ kujto.peterdsp.dev source bin/ install.sh, wire.sh, simulator.sh, skills/install-skills.sh ``` ## 开发 ``` # CLI + engine xcrun swift build xcrun swift test # 45 tests, all green # Mac app + Xcode 扩展 cd integrations/xcode-extension xcodegen generate xcrun xcodebuild -project KujtoStudio.xcodeproj -scheme KujtoStudio \ -destination "platform=macOS" build # 预览营销网站 cd site && python3 -m http.server 8000 && open http://localhost:8000 ``` CI pipeline 会在每次推送到 `main` 分支时运行 `swift build`、`swift test`、ShellCheck、无破折号检查、`applies_to` frontmatter 验证器以及提交信息尾部策略。 ## 路线图 - **Beta**:TestFlight 上的 Mac 应用,Marketplace 中的 VS Code / Cursor 扩展 - **TCA reducer 图**(付费层级):SwiftSyntax 传递,映射 State、Action、依赖 client 和导航 - **菜单栏助手**和用于 Shortcuts 的 **App Intents**(`Summarize repo rules`、`Prepare agent context`) - 记忆和规则的 **Spotlight 索引** - **团队记忆模板**:在整个团队中共享和对约定进行版本控制,无需重复记忆 ## 许可证 [MIT](LICENSE)。由 [@peterdsp](https://github.com/peterdsp) 构建。 Kujto 在阿尔巴尼亚语中的意思是“记住”。该产品因其功能而得名:在它们修改文件之前,将你代码库的记忆保留在每个编辑器和每个 agent 面前。
标签:AI上下文管理, AI编程助手, macOS应用, SOC Prime, Swift, 代码规范, 开发工具