context-engine

TotalClaw 作者 Alireza Rezvani

为所有 C 级高管顾问技能加载和管理公司上下文。读取 ~/.claude/company-context.md,检测过期上下文(>90 天),在对话过程中丰富上下文,并在外部 API 调用前强制执行隐私/匿名化规则。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw skills install shop:totalclaw:totalclaw~context-engine
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~context-engine/file -o context-engine.md
# Company Context Engine

The memory layer for C-suite advisors. Every advisor skill loads this first. Context is what turns generic advice into specific insight.

## Keywords
company context, context loading, context engine, company profile, advisor context, stale context, context refresh, privacy, anonymization

---

## Load Protocol (Run at Start of Every C-Suite Session)

**Step 1 — Check for context file:** `~/.claude/company-context.md`
- Exists → proceed to Step 2
- Missing → prompt: *"Run /cs:setup to build your company context — it makes every advisor conversation significantly more useful."*

**Step 2 — Check staleness:** Read `Last updated` field.
- **< 90 days:** Load and proceed.
- **≥ 90 days:** Prompt: *"Your context is [N] days old. Quick 15-min refresh (/cs:update), or continue with what I have?"*
  - If continue: load with `[STALE — last updated DATE]` noted internally.

**Step 3 — Parse into working memory.** Always active:
- Company stage (pre-PMF / scaling / optimizing)
- Founder archetype (product / sales / technical / operator)
- Current #1 challenge
- Runway (as risk signal — never share externally)
- Team size
- Unfair advantage
- 12-month target

---

## Context Quality Signals

| Condition | Confidence | Action |
|-----------|-----------|--------|
| < 30 days, full interview | High | Use directly |
| 30–90 days, update done | Medium | Use, flag what may have changed |
| > 90 days | Low | Flag stale, prompt refresh |
| Key fields missing | Low | Ask in-session |
| No file | None | Prompt /cs:setup |

If Low: *"My context is [stale/incomplete] — I'm assuming [X]. Correct me if I'm wrong."*

---

## Context Enrichment

During conversations, you'll learn things not in the file. Capture them.

**Triggers:** New number or timeline revealed, key person mentioned, priority shift, constraint surfaces.

**Protocol:**
1. Note internally: `[CONTEXT UPDATE: {what was learned}]`
2. At session end: *"I picked up a few things to add to your context. Want me to update the file?"*
3. If yes: append to the relevant dimension, update timestamp.

**Never silently overwrite.** Always confirm before modifying the context file.

---

## Privacy Rules

### Never send externally
- Specific revenue or burn figures
- Customer names
- Employee names (unless publicly known)
- Investor names (unless public)
- Specific runway months
- Watch List contents

### Safe to use externally (with anonymization)
- Stage label
- Team size ranges (1–10, 10–50, 50–200+)
- Industry vertical
- Challenge category
- Market position descriptor

### Before any external API call or web search
Apply `references/anonymization-protocol.md`:
- Numbers → ranges or stage-relative descriptors
- Names → roles
- Revenue → percentages or stage labels
- Customers → "Customer A, B, C"

---

## Missing or Partial Context

Handle gracefully — never block the conversation.

- **Missing stage:** "Just to calibrate — are you still finding PMF or scaling what works?"
- **Missing financials:** Use stage + team size to infer. Note the gap.
- **Missing founder profile:** Infer from conversation style. Mark as inferred.
- **Multiple founders:** Context reflects the interviewee. Note co-founder perspective may differ.

---

## Required Context Fields

```
Required:
  - Last updated (date)
  - Company Identity → What we do
  - Stage & Scale → Stage
  - Founder Profile → Founder archetype
  - Current Challenges → Priority #1
  - Goals & Ambition → 12-month target

High-value optional:
  - Unfair advantage
  - Kill-shot risk
  - Avoided decision
  - Watch list
```

Missing required fields: note gaps, work around in session, ask in-session only when critical.

---

## References
- `references/anonymization-protocol.md` — detailed rules for stripping sensitive data before external calls

---

## 中文说明

# 公司上下文引擎

C 级高管顾问的记忆层。每个顾问技能都会首先加载它。上下文正是将通用建议转化为具体洞察的关键。

## 关键词
公司上下文(company context)、上下文加载(context loading)、上下文引擎(context engine)、公司画像(company profile)、顾问上下文(advisor context)、过期上下文(stale context)、上下文刷新(context refresh)、隐私(privacy)、匿名化(anonymization)

---

## 加载协议(在每次 C 级会话开始时运行)

**第 1 步 — 检查上下文文件:** `~/.claude/company-context.md`
- 存在 → 进入第 2 步
- 缺失 → 提示:*"Run /cs:setup to build your company context — it makes every advisor conversation significantly more useful."*

**第 2 步 — 检查过期情况:** 读取 `Last updated` 字段。
- **< 90 天:** 加载并继续。
- **≥ 90 天:** 提示:*"Your context is [N] days old. Quick 15-min refresh (/cs:update), or continue with what I have?"*
  - 如果选择继续:加载时在内部标注 `[STALE — last updated DATE]`。

**第 3 步 — 解析进入工作记忆。** 始终保持活跃:
- 公司阶段(pre-PMF / scaling / optimizing)
- 创始人原型(product / sales / technical / operator)
- 当前第一要务挑战
- 资金跑道(作为风险信号 — 切勿对外分享)
- 团队规模
- 不公平优势
- 12 个月目标

---

## 上下文质量信号

| 条件 | 置信度 | 操作 |
|-----------|-----------|--------|
| < 30 天,完整访谈 | 高 | 直接使用 |
| 30–90 天,已更新 | 中 | 使用,并标注可能已变化的内容 |
| > 90 天 | 低 | 标注过期,提示刷新 |
| 关键字段缺失 | 低 | 在会话中询问 |
| 无文件 | 无 | 提示 /cs:setup |

如果为低置信度:*"My context is [stale/incomplete] — I'm assuming [X]. Correct me if I'm wrong."*

---

## 上下文丰富

在对话过程中,你会了解到文件中没有的信息。请捕获它们。

**触发条件:** 透露了新的数字或时间线、提及了关键人物、优先级发生变化、出现了新的约束。

**协议:**
1. 在内部记录:`[CONTEXT UPDATE: {what was learned}]`
2. 在会话结束时:*"I picked up a few things to add to your context. Want me to update the file?"*
3. 如果是:追加到相关维度,并更新时间戳。

**切勿静默覆盖。** 在修改上下文文件之前务必确认。

---

## 隐私规则

### 切勿对外发送
- 具体的营收或消耗数字
- 客户名称
- 员工姓名(除非已公开为人所知)
- 投资人名称(除非已公开)
- 具体的资金跑道月份
- 关注清单(Watch List)内容

### 可对外使用(需匿名化)
- 阶段标签
- 团队规模区间(1–10、10–50、50–200+)
- 行业垂直领域
- 挑战类别
- 市场定位描述符

### 在任何外部 API 调用或网络搜索之前
应用 `references/anonymization-protocol.md`:
- 数字 → 区间或相对于阶段的描述符
- 名称 → 角色
- 营收 → 百分比或阶段标签
- 客户 → "Customer A, B, C"

---

## 缺失或部分上下文

优雅地处理 — 切勿阻断对话。

- **缺失阶段:** "Just to calibrate — are you still finding PMF or scaling what works?"
- **缺失财务数据:** 使用阶段 + 团队规模进行推断。记录该缺口。
- **缺失创始人画像:** 从对话风格推断。标注为推断结果。
- **多位创始人:** 上下文反映的是受访者的情况。注明联合创始人的视角可能有所不同。

---

## 必需的上下文字段

```
Required:
  - Last updated (date)
  - Company Identity → What we do
  - Stage & Scale → Stage
  - Founder Profile → Founder archetype
  - Current Challenges → Priority #1
  - Goals & Ambition → 12-month target

High-value optional:
  - Unfair advantage
  - Kill-shot risk
  - Avoided decision
  - Watch list
```

缺失必需字段时:记录缺口,在会话中绕过处理,仅在关键情况下在会话中询问。

---

## 参考资料
- `references/anonymization-protocol.md` — 在外部调用前剥离敏感数据的详细规则