Skip to content

feat: inject Karpathy coding principles into agent prompts - #34

Merged
MatthewYe merged 4 commits into
mainfrom
feat/karpathy-principles-injection
Jun 8, 2026
Merged

feat: inject Karpathy coding principles into agent prompts#34
MatthewYe merged 4 commits into
mainfrom
feat/karpathy-principles-injection

Conversation

@MatthewYe

Copy link
Copy Markdown
Owner

Summary

将 Andrej Karpathy 四条编码原则内建到 toolbox 插件中,CLAUDE.md 已剥离,原则随插件自动注入。

How it works

两层注入

层级 机制 文件 内容
Primary agent config.instructions principles/karpathy-primary.md 完整四原则
Subagent config.agent.*.prompt prepend principles/karpathy.md (解析) 角色裁剪

Agent 裁剪映射

Agent 原则 #1 变体
primary (general) 1,2,3,4 Think Before Coding
implementer 1,2,3,4 Think Before Coding
reviewer 1,2,4 Think Before Judging
argus 1,2,4 Think Before Analyzing
explore 跳过

验证结果

Agent 结果
primary ✓ 全四
implementer ✓ 全四
reviewer ✓ Judging + 2 + 4
argus ✓ Analyzing + 2 + 4
explore 漏入 (instructions 全局机制限制,不影响功能)

文件变更

  • principles/karpathy.md — 四原则全文 + 三变体
  • principles/karpathy-primary.md — 四原则(仅 primary)
  • src/index.ts — 解析 + 注入逻辑
  • src/index.test.ts — 5 个 agent × 6 项测试
  • package.json — files 数组补充

Closes #33

MatthewYe added 4 commits June 8, 2026 15:24
- Add principles/karpathy.md with all 4 principles + 3 role variants
- Add principles/karpathy-primary.md for primary agent (via config.instructions)
- Parse and inject role-tailored principles via config.agent.prompt for subagents:
  - implementer/general: full 4 principles
  - reviewer: Think Before Judging + Simplicity + Goal-Driven
  - argus: Think Before Analyzing + Simplicity + Goal-Driven
  - explore: skipped
- Primary agent gets full 4 principles via config.instructions

Closes #33
@MatthewYe
MatthewYe merged commit 3d37ffc into main Jun 8, 2026
1 check passed
@MatthewYe
MatthewYe deleted the feat/karpathy-principles-injection branch June 8, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

内建 Karpathy 编码原则,按 agent 角色裁剪注入 prompt

1 participant