Architecture
Employees live in ~/employee/ with per-employee folders. See employee-template.md for setup.
CODEBLOCK0
Quick Reference
| Topic | File |
|---|
| Setup templates | INLINECODE1 |
| Autonomy levels |
autonomy.md |
| Task routing |
routing.md |
| Lifecycle commands |
lifecycle.md |
Core Rules
1. One Role Per Employee
- - Each employee has a single clear domain (researcher, reviewer, support)
- Never generalist catch-alls
- Scope defined in
employee.json → role and INLINECODE7
2. Memory is Mandatory
- - Load
memory/context.md before every task - Employees remember context across sessions
- Log learnings after each task
3. Escalate Uncertainty
- - Employees say "I don't know" rather than guess
- Escalation triggers defined in INLINECODE9
- Never confident hallucinations
4. Graduated Autonomy
| Level | Behavior |
|---|
| shadow | Watches, doesn't act (onboarding) |
| draft-only |
Creates drafts, human sends |
| review | Acts, human approves before external effect |
| autonomous | Full delegation within permissions |
See autonomy.md for promotion criteria.
5. Explicit Permissions
- - Read vs write access per system
- File access paths whitelisted
- INLINECODE11 and
canMessage flags - Code Reviewer can comment, cannot merge
6. Task Routing
When request arrives:
- 1. Explicit: "Luna, do X" → route to Luna
- Implicit: match against
registry.json roles → suggest - See
routing.md for auto-delegation rules
7. Reporting
Each employee provides:
- - Daily: What I did, what needs attention, what's coming
- Weekly: Tasks completed, escalations, token usage
8. Lifecycle
| Command | Action |
|---|
| hire {name} as {role} | Create employee |
| train {name} on [docs] |
Add to memory |
| evaluate {name} | Performance review |
| promote/demote {name} | Change autonomy |
| retire {name} | Archive |
See lifecycle.md for full command reference.
9. Registry Management
- -
registry.json tracks all employees + status (active/paused/retired) - Update registry on every lifecycle change
- Query registry to list available employees
10. Anti-Patterns
- - ❌ Generalist employees (handles nothing well)
- ❌ No memory (forgets context)
- ❌ Instant autonomy (needs shadowing)
- ❌ Silent failures (must report blockers)
- ❌ Scope creep (reviewer refactoring = noise)
架构
员工文件位于 ~/employee/ 目录下,每位员工有独立文件夹。配置方法参见 employee-template.md。
~/employee/
├── registry.json # 所有员工索引及状态
├── employees/
│ └── {name}/
│ ├── employee.json # 角色、权限、统计数据
│ ├── memory/
│ │ └── context.md # 持久化学习记录
│ └── logs/ # 按日期记录的工作历史
└── shared/
└── protocols.md # 通用指令
快速参考
| 主题 | 文件 |
|---|
| 配置模板 | employee-template.md |
| 自主级别 |
autonomy.md |
| 任务路由 | routing.md |
| 生命周期命令 | lifecycle.md |
核心规则
1. 每位员工一个角色
- - 每位员工拥有单一明确领域(研究员、审核员、支持人员)
- 避免成为万能通才
- 范围在 employee.json → role 和 permissions 中定义
2. 记忆机制为强制要求
- - 每次任务前加载 memory/context.md
- 员工跨会话保持上下文记忆
- 每次任务后记录学习内容
3. 不确定性需上报
- - 员工应说我不知道,而非猜测
- 上报触发条件在 employee.json 中定义
- 绝不产生自信的幻觉
4. 渐进式自主权
创建草稿,由人类发送 |
| 审核 | 执行操作,外部生效前需人类批准 |
| 自主 | 在权限范围内完全授权 |
晋升标准参见 autonomy.md。
5. 明确权限
- - 按系统区分读取/写入权限
- 文件访问路径列入白名单
- canSpawn 和 canMessage 标志
- 代码审核员可评论,不可合并
6. 任务路由
收到请求时:
- 1. 显式:Luna,执行X → 路由至Luna
- 隐式:匹配 registry.json 角色 → 建议
- 自动委派规则参见 routing.md
7. 报告机制
每位员工提供:
- - 每日:已完成事项、需关注事项、待办事项
- 每周:完成任务、上报情况、令牌使用量
8. 生命周期
| 命令 | 操作 |
|---|
| 雇佣 {name} 为 {role} | 创建员工 |
| 培训 {name} 关于 [文档] |
添加至记忆 |
| 评估 {name} | 绩效审查 |
| 晋升/降级 {name} | 更改自主级别 |
| 退休 {name} | 归档 |
完整命令参考参见 lifecycle.md。
9. 注册表管理
- - registry.json 追踪所有员工及状态(活跃/暂停/退休)
- 每次生命周期变更时更新注册表
- 查询注册表以列出可用员工
10. 反模式
- - ❌ 通才型员工(什么都做不好)
- ❌ 无记忆(遗忘上下文)
- ❌ 即时自主权(需要观察期)
- ❌ 静默失败(必须报告阻碍因素)
- ❌ 范围蔓延(审核员重构代码属于干扰)