Skip to content

Latest commit

 

History

History
747 lines (464 loc) · 18.6 KB

File metadata and controls

747 lines (464 loc) · 18.6 KB

SelfCtx

一句话:把你的工作方式、项目背景、偏好规则存成 Markdown,粘贴到任何 AI 模型立刻生效。

切换模型不再从零开始 · 2 分钟恢复完整上下文

GitHub stars

License: MIT

English · 快速开始 · 博客文章


💡 这是什么?

你是否遇到过这些问题:

  • ❌ 每次换模型要重新“调教”,花 30-50 分钟

  • ❌ Claude 记住的上下文,ChatGPT 完全不知道

  • ❌ 平台的 Memory 功能被锁死,无法导出迁移

  • ❌ 不确定哪些信息可以给 AI,哪些不能

SelfCtx 让你

  • 2 分钟恢复完整上下文(vs 传统 30-50 分钟)

  • ✅ 一份文件,所有模型通用(Claude、ChatGPT、Gemini、DeepSeek……)

  • ✅ 本地掌控,随时导出迁移

  • ✅ 4 个披露级别,按需分级共享


🎯 工作原理

graph TB
    A[📁 my_pca/ 本地文件夹] --> B[D1_identity.md]
    A --> C[D2_cognitive_os.md 🔥]
    A --> D[D5_capabilities.md]
    A --> E[D8_projects.md]
    
    A --> F[⚙️ build.py]
    
    F --> G[📦 exports/]
    G --> H[L0_public.md<br>500 tokens]
    G --> I[L1_work.md<br>2000 tokens]
    G --> J[L2_trusted.md<br>5000 tokens]
    G --> K[L3_full.md<br>完整版]
    
    I -.📋 复制粘贴.-> L[🤖 AI 模型]
    L --> M[Claude]
    L --> N[ChatGPT]
    L --> O[Gemini]
    L --> P[DeepSeek]
    
    style C fill:#ff6b6b,color:#fff
    style I fill:#51cf66,color:#fff
    style L fill:#4dabf7,color:#fff
Loading

核心思路

  1. 把你的工作方式、技能、项目写成 10 个 Markdown 文件

  2. 用脚本合并成不同级别的文件(L0-L3)

  3. 复制粘贴到任何 AI 模型,立刻生效


🚀 快速开始(5 分钟)

第 1 步:克隆仓库

git clone https://github.com/s87343472/selfctx.git
cd selfctx

第 2 步:填写你的信息

打开 my_pca/ 文件夹,编辑这 4 个核心文件:

my_pca/
├── D1_identity.md          # 你是谁(职业、背景)
├── D2_cognitive_os.md      # 🔥 核心!AI 必须遵守的规则
├── D5_capabilities.md      # 你的技能和专长
└── D8_projects.md          # 当前项目

💡 不知道怎么写?点击查看示例

D2_cognitive_os.md 示例(这是最重要的文件):

# D2 认知操作系统

## 输出规则
- 永远用中文回复
- 代码必须带注释
- 给我 3 个方案而不是 1 个

## 工作方式
- 我偏好渐进式实现,不要一次性大重构
- 遇到技术选型先问我,不要自己决定

## 禁止事项
❌ 不要直接给代码让我复制粘贴(我要理解原理)
❌ 不要用"应该"、"可能"等模糊词汇(要明确)

完整示例:查看 examples/product_manager/ 文件夹

第 3 步:生成可粘贴的文件

python build.py --level L1  # 生成工作版(推荐)

会在 exports/ 生成 L1_work.md

第 4 步:粘贴到任何 AI

复制 exports/L1_work.md 的内容,粘贴到:

AI 模型 粘贴位置
Claude Project Knowledge
ChatGPT Custom Instructions 或对话开头
Gemini System Instructions
DeepSeek / Qwen 对话开头

完成! AI 现在记住你了 🎉


📊 实际效果对比

❌ 没有 SelfCtx

你: 帮我写个 React 组件

AI: 好的,这是一个基础组件...
    (生成 class 组件)

你: 我要函数式组件,用 TypeScript,带单测

AI: 好的,重新写...

你: 用我们项目的 design system

AI: 你们用什么 design system?

✅ 使用 SelfCtx(L1 级别)

你: 帮我写个 React 组件

AI: 根据你的技术栈(React 18 + TS + Vitest),
    使用你们的 Ant Design 5.0 规范,
    这是函数式组件 + 单测...
    
    [直接给出符合项目规范的代码]

节省时间:从每次 30-50 分钟 → 2 分钟


🎚️ 4 个披露级别

级别 Token 包含内容 适用场景
L0 公开版 <500 身份标签 + 行为规则 公开分享、演示
L1 工作版 <2000 + 项目/技能/工作关系 日常推荐
L2 信任版 <5000 全部维度(脱敏) 长期主力模型
L3 全量版 不限 原始数据 仅本地,永不外发

首次建立:15-30 分钟之后迁移:2 分钟


📐 10 个维度详解

graph TD
    D1[D1 叙事身份<br>年度更新] --> D2[D2 认知 OS 🔥<br>季度更新]
    
    D2 --> D3[D3 具身状态<br>月度更新]
    D2 --> D4[D4 情绪心理<br>月度更新]
    D2 --> D5[D5 能力专长<br>季度更新]
    
    D5 --> D6[D6 资产图谱<br>季度更新]
    D5 --> D7[D7 关系网络<br>季度更新]
    D5 --> D8[D8 项目快照<br>月度更新]
    
    D1 --> D9[D9 兴趣审美<br>年度更新]
    D1 --> D10[D10 世界观志向<br>年度更新]
    
    style D2 fill:#ff6b6b,color:#fff
    style D5 fill:#51cf66,color:#fff
    style D8 fill:#ffd93d,color:#000
Loading

点击展开完整维度说明

# 维度 更新频率 说明
D1 叙事身份 年度 我是谁(职业、教育、地域)
D2 认知操作系统 季度 🔥 核心!AI 的强制规则
D3 具身状态 月度 健康、能量、作息
D4 情绪与心理 月度 可选,当前心理状态
D5 能力与专长 季度 技能树、工具链
D6 资产图谱 季度 产品/设备/代码库
D7 关系网络 季度 工作关系、协作者
D8 项目快照 月度 3-12 个月窗口的项目
D9 兴趣与审美 年度 偏好、品味
D10 世界观与志向 年度 长期目标、价值观

D2 是核心。 它存的不是偏好,是规则——粘贴进任何模型立刻强制执行。


🤖 模型兼容性

模型 L0 L1 L2 备注
Claude Opus 4.8 / Sonnet 4.6 完美支持
GPT-5.5 / GPT-5.4 完美支持
Gemini 3.1 Pro 完美支持
Gemini 3 Flash 基本可用
Grok 4 / 4.3 基本可用
DeepSeek V3.2 基本可用
Qwen 3.5 基本可用
Mistral Large 基本可用

✓ 完全支持 · △ 基本可用,部分字段识别不够精准


🔒 安全提醒

⚠️ 重要:把这些文件加入 .gitignore

# SelfCtx 敏感文件
exports/L3_full.md
my_pca/D4_emotional.md
my_pca/D7_relationships.md

隐私原则

  • ✅ L0/L1 可以公开分享

  • ⚠️ L2 只给信任的主力模型

  • ❌ L3 永远不要上传到任何平台


❓ FAQ

Q: 和平台的 Memory 功能有什么区别?

A: 平台 Memory 被锁死在单一模型,无法导出或迁移。SelfCtx 是本地 Markdown 文件,你完全掌控,可以跨所有模型使用。

Q: 需要编程基础吗?

A: 不需要。只需要会编辑 Markdown 文件。build.py 是可选的,你也可以手动合并文件。

Q: Token 会不会太多?

A: L1 工作版 <2000 tokens,相当于一页 A4 纸。现代模型支持 128K-200K tokens,完全无压力。

Q: 多久更新一次?

A:

  • D2(认知 OS):每季度审视一次

  • D8(项目快照):每月更新

  • D1/D9/D10:每年更新

  • 其他维度:按需更新

Q: 可以团队共享吗?

A: 可以!导出 L0 公开版给团队,包含团队的工作规范和行为准则。每个人再基于此添加自己的个人维度。

Q: 和 Anthropic Projects 有什么区别?

A: Anthropic Projects 只能在 Claude 中使用。SelfCtx 是模型无关的,可以在任何 AI 模型中使用,包括本地模型。


📚 示例文件

我们提供了 3 个职业的完整示例:

  • 产品经理 - B2B SaaS 产品经理的完整配置

  • 开发者 - 全栈开发者的技术栈和工作流

  • 设计师 - UI/UX 设计师的设计原则和工具链

每个示例都包含:

  • ✅ 完整的 10 个维度文件

  • ✅ 可直接使用的 L1 工作版

  • ✅ 详细的填写说明


🎁 进阶:Claude Skill(可选)

如果你用 Claude,可以安装增强技能:

  1. 下载 selfctx.skill

  2. Claude 设置 → Skills → Import

  3. 获得能力:

    • 自动搜索历史对话

    • 结构化导出上下文

    • 对话中直接更新维度

需要 Claude 3.5+


🗺️ Roadmap

  • 基础框架和 10 个维度

  • 4 级披露系统

  • Claude Skill 集成

  • VS Code 插件(一键同步)

  • Web 可视化编辑器

  • 团队版(共享 L0 + 个人 L1-L3)

  • AI 自动提取(从历史对话生成 SelfCtx)


🤝 贡献 & 反馈

  • 🐛 提交 Bug

  • 💡 功能建议

  • ⭐ 如果有用,请点 Star

  • 🔀 欢迎提交 PR(尤其是新的职业示例)


📖 延伸阅读


📄 License

MIT License - 详见 LICENSE


👤 关于作者

SagaSu - 产品人 × AI 实践者

不会写代码,用 AI Agent 从零造了 OmniConvert3900+ 页、8 种语言、73 种文件格式互转的在线工具

Twitter

Blog


如果 SelfCtx 帮到了你,请点 ⭐ Star 支持一下!



SelfCtx (English)

One sentence: Store your work style, project context, and behavior rules as Markdown, paste into any AI model, works instantly.

Stop re-introducing yourself · Context restored in 2 minutes

GitHub stars

License: MIT

中文 · Quick Start · Blog Post


💡 What is this?

Have you ever experienced:

  • 30-50 min to re-onboard a new model

  • ❌ Context scattered across platforms

  • ❌ Platform memory can't cross models

  • ❌ Unsure what's safe to share

SelfCtx gives you:

  • 2 min to restore full context (vs 30-50 min)

  • ✅ One file, all models (Claude, ChatGPT, Gemini, DeepSeek...)

  • ✅ Plain Markdown, locally owned

  • ✅ 4 disclosure levels, you decide


🎯 How it works

graph TB
    A[📁 my_pca/ Local folder] --> B[D1_identity.md]
    A --> C[D2_cognitive_os.md 🔥]
    A --> D[D5_capabilities.md]
    A --> E[D8_projects.md]
    
    A --> F[⚙️ build.py]
    
    F --> G[📦 exports/]
    G --> H[L0_public.md<br>500 tokens]
    G --> I[L1_work.md<br>2000 tokens]
    G --> J[L2_trusted.md<br>5000 tokens]
    G --> K[L3_full.md<br>Full version]
    
    I -.📋 Copy & Paste.-> L[🤖 AI Models]
    L --> M[Claude]
    L --> N[ChatGPT]
    L --> O[Gemini]
    L --> P[DeepSeek]
    
    style C fill:#ff6b6b,color:#fff
    style I fill:#51cf66,color:#fff
    style L fill:#4dabf7,color:#fff
Loading

Core idea:

  1. Write your work style, skills, projects as 10 Markdown files

  2. Merge into different levels (L0-L3) with script

  3. Copy & paste into any AI model, works instantly


🚀 Quick Start (5 minutes)

Step 1: Clone the repo

git clone https://github.com/s87343472/selfctx.git
cd selfctx

Step 2: Fill in your info

Edit these 4 core files in my_pca/:

my_pca/
├── D1_identity.md          # Who you are
├── D2_cognitive_os.md      # 🔥 Core! AI behavior rules
├── D5_capabilities.md      # Your skills
└── D8_projects.md          # Current projects

💡 Need examples? Click to view

D2_cognitive_os.md example (Most important file):

# D2 Cognitive OS

## Output Rules
- Always reply in English
- Code must have comments
- Give me 3 options, not 1

## Work Style
- Prefer incremental implementation, no big refactors
- Ask me before making tech choices

## Don'ts
❌ Don't just give code to copy-paste (explain the logic)
❌ Don't use vague words like "should", "might" (be specific)

Full examples: See examples/product_manager/

Step 3: Generate paste-ready file

python build.py --level L1  # Generate work version (recommended)

This creates exports/L1_work.md

Step 4: Paste into any AI

Copy exports/L1_work.md content and paste into:

AI Model Where to paste
Claude Project Knowledge
ChatGPT Custom Instructions or start of chat
Gemini System Instructions
DeepSeek / Qwen Start of chat

Done! AI now remembers you 🎉


📊 Effect Comparison

❌ Without SelfCtx

You: Write a React component

AI: Here's a basic component...
    (generates class component)

You: I need functional, TypeScript, with tests

AI: OK, rewriting...

You: Use our design system

AI: Which design system do you use?

✅ With SelfCtx (L1 level)

You: Write a React component

AI: Based on your stack (React 18 + TS + Vitest),
    using your Ant Design 5.0 specs,
    here's a functional component + tests...
    
    [Directly gives code matching your standards]

Time saved: From 30-50 min → 2 min


🎚️ 4 Disclosure Levels

Level Tokens Contents Use Case
L0 Public <500 Identity tags + behavior rules Share freely, zero risk
L1 Work <2000 + Projects / expertise / work relationships Daily AI collaboration (recommended start)
L2 Trusted <5000 All dimensions, sensitive fields redacted Long-term primary model
L3 Full Unlimited Raw data Local only, never share

First setup: ~15–30 minEvery migration after: ~2 min


📐 10 Dimensions Explained

graph TD
    D1[D1 Narrative Identity<br>Yearly update] --> D2[D2 Cognitive OS 🔥<br>Quarterly update]
    
    D2 --> D3[D3 Embodied State<br>Monthly update]
    D2 --> D4[D4 Emotional State<br>Monthly update]
    D2 --> D5[D5 Capabilities<br>Quarterly update]
    
    D5 --> D6[D6 Asset Map<br>Quarterly update]
    D5 --> D7[D7 Relationships<br>Quarterly update]
    D5 --> D8[D8 Project Snapshot<br>Monthly update]
    
    D1 --> D9[D9 Interests<br>Yearly update]
    D1 --> D10[D10 Worldview<br>Yearly update]
    
    style D2 fill:#ff6b6b,color:#fff
    style D5 fill:#51cf66,color:#fff
    style D8 fill:#ffd93d,color:#000
Loading

Click to expand full dimension list

# Dimension Update Freq Description
D1 Narrative Identity Yearly Who I am (career, education, location)
D2 Cognitive OS Quarterly 🔥 Core! Hard rules for AI
D3 Embodied State Monthly Health & energy
D4 Emotional & Psychological Monthly Optional, current mental state
D5 Capabilities & Expertise Quarterly Skills, toolchain
D6 Asset Map Quarterly Products / devices / repos
D7 Relationship Network Quarterly Work relationships
D8 Project Snapshot Monthly 3–12 month window
D9 Interests & Aesthetics Yearly Preferences, taste
D10 Worldview & Aspirations Yearly Long-term goals, values

D2 is the core. It stores not preferences but enforced rules — active the moment you paste them.


🤖 Model Compatibility

Model L0 L1 L2 Notes
Claude Opus 4.8 / Sonnet 4.6 Full support
GPT-5.5 / GPT-5.4 Full support
Gemini 3.1 Pro Full support
Gemini 3 Flash Works well
Grok 4 / 4.3 Works well
DeepSeek V3.2 Works well
Qwen 3.5 Works well
Mistral Large Works well

✓ Full support · △ Works, some fields less accurately parsed


🔒 Security

⚠️ Important: Add these to .gitignore:

# SelfCtx sensitive files
exports/L3_full.md
my_pca/D4_emotional.md
my_pca/D7_relationships.md

Privacy principles:

  • ✅ L0/L1 safe to share publicly

  • ⚠️ L2 only for trusted primary models

  • ❌ L3 never upload anywhere


❓ FAQ

**Q: How is this different from platform Memory?**A: Platform Memory is locked to one model. SelfCtx is local Markdown, portable across all models.

**Q: Do I need programming skills?**A: No. Just edit Markdown files. build.py is optional.

**Q: Won't this use too many tokens?**A: L1 is <2000 tokens (one A4 page). Modern models handle 128K–200K tokens easily.

**Q: How often to update?**A: D2 (Cognitive OS) quarterly, D8 (Projects) monthly, D1/D9/D10 yearly.

**Q: Can teams share this?**A: Yes! Export L0 public version for team standards. Each person adds their personal dimensions.


📚 Examples

  • Product Manager - Full B2B SaaS PM config

  • Developer - Full-stack dev tech stack

  • Designer - UI/UX design principles


🤝 Contributing


📖 Further Reading


📄 License

MIT License - see LICENSE


If SelfCtx helped you, please ⭐ Star to support!

Made with ❤️ by SagaSu