CS

cxorz/smart-codebase

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

71 stars 质量 61 趋势 14Apache-2.0

一个OpenCode插件。让你的编码代理在每一项任务中学习和成长。

概览

每次你开始新会话,AI都会从零开始。它不记得:- 你为什么选择那个架构?- 你的代码库里有哪些陷阱?- 你的团队遵循什么模式?- 你从调试那个讨厌的bug学到了什么? Smart-Codebase 通过 SKILL 文件为你的 AI 提供永久记忆。它使用 AI 代理自主捕获你的对话和项目文件中的知识。 1. - 编辑文件、调试问题并做出架构决策。2. - 运行一次 /sc-init 扫描源代码并生成全面的 SKILL 文件。3. 当你达到某个里程碑时,运行 /sc-update 从当前会话中提取知识。4. - 子 AI 会话会检查你的对话或项目代码,以理解发生了哪些变化及其原因。5. - 代理自动编写或更新标准 OpenCode 格式的 SKILL 文件。6. - 新会话会自动发现你的项目 SKILLs,为 AI 提供即时上下文。 导航到你的 ~/.config/opencode 目录: 创建 ~/。

概述(AI 翻译)

英文 |简体中文

将你的OpenCode转变为一个随着每一项任务不断学习和成长的高级项目专家。


🔥 痛点

每次你开始新游戏,AI都会从头开始。它不会记住:

  • 你为什么选择那种建筑?
  • 你的代码库里有哪些陷阱?
  • 你们团队遵循什么模式?
  • 你从调试那个讨厌的漏洞学到了什么?

你总是一遍又一遍地解释同样的事情。

✨ 解决方案

Smart-Codebase 通过 SKILL 文件为你的 AI 提供永久记忆。它使用 AI 代理自主捕获你的对话和项目文件中的知识。


📖 目录

  • ⚙️ 工作原理
  • 📦 安装
  • ⚡ 命令
  • ⚙️ 配置
  • 📁 文件结构
  • 🛠️ 发展

⚙️ 工作原理

  1. 你正常工作 - 编辑文件、调试问题,并做出架构决策。
  2. 首次设置 - 运行一次/sc-init扫描源代码并生成完整的SKILL文件。
  3. 持续捕获 - 当你达到一个里程碑时,运行/sc-update以提取当前会话中的知识。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Smart-Codebase

English | 简体中文

Turn your OpenCode into a senior project expert that learns and grows with every task.


🔥 The Pain Point

Every time you start a new session, AI starts from scratch. It doesn’t remember:

  • Why you chose that architecture?
  • What gotchas exist in your codebase?
  • What patterns your team follows?
  • What you learned from debugging that nasty bug?

You explain the same things over and over.

✨ The Solution

Smart-Codebase gives your AI permanent memory through SKILL files. It uses an AI agent to autonomously capture knowledge from your conversations and project files.

graph TB
    Start([Session Work])
    Init[sc-init command]
    Update[sc-update command]
    InitAgent[AI Scans Source Code]
    UpdateAgent[AI Analyzes Session]
    SkillFile[.opencode/skills/project/SKILL.mdOpenCode Auto-Discovery]
    RefFiles[.opencode/skills/project/reference/*.mdDeep Dive Docs]
    NewSession([New Session Starts])
    Injector[Context Injector]
    
    Start --> Init
    Start --> Update
    Init --> InitAgent
    Update --> UpdateAgent
    InitAgent -->|writes| SkillFile
    InitAgent -->|writes| RefFiles
    UpdateAgent -->|updates| SkillFile
    UpdateAgent -->|updates| RefFiles
    
    NewSession --> Injector
    Injector -->|inject hint| SkillFile

📖 Table of Contents


⚙️ How It Works

  1. You work normally - Edit files, debug issues, and make architectural decisions.
  2. First time setup - Run /sc-init once to scan your source code and generate comprehensive SKILL files.
  3. Ongoing capture - When you reach a milestone, run /sc-update to extract knowledge from the current session.
  4. AI Agent analyzes - A child AI session examines your conversation or project code to understand what changed and why.
  5. Knowledge distilled - The agent autonomously writes or updates SKILL files in standard OpenCode format.
  6. Next session starts - New sessions auto-discover your project SKILLs, giving the AI immediate context.

Manual control means you decide exactly when to preserve knowledge. The AI agent handles the heavy lifting of writing documentation.


📦 Installation

Navigate to your ~/.config/opencode directory:

# Using bun
bun add smart-codebase

# Or using npm
npm install smart-codebase

Add to your opencode.json:

{
  "plugin": ["smart-codebase"]
}

⚡ Commands

Command Description
/sc-init [focus?] Initialize project SKILL files by scanning source code. Run once before your first /sc-update.
/sc-update [focus?] Trigger the AI agent to extract knowledge from the current session.

在 GitHub 查看完整 README

推荐工具

换一个关键词,或者移除筛选条件。

安装

npx skillfish add cxorz/smart-codebase
新手?先看 mcpskill.org 教程 →