Nate Jones Second Brain
When intelligence is abundant, context becomes the scarce resource. This skill is context architecture — a persistent, searchable knowledge layer that turns your agent into a personal knowledge manager.
Two opinionated primitives:
- - Supabase — your database, and so much more. PostgreSQL + pgvector. Stores thoughts, people, projects, ideas, and tasks as structured data with vector embeddings. REST API built in. Your data, your infrastructure. Models come and go; your context persists. And once you have a Supabase project, you've unlocked the foundation for everything else you'll want to build — the Second Brain is just the beginning.
- OpenRouter — your AI gateway. One API key, every model. Embeddings and LLM calls for classification and routing. Swap models by changing a string. Future-proof by design.
Everything else — how you capture thoughts, how you retrieve them, what you build on top — is application layer. The skill covers the foundation.
If the tables don't exist yet, see INLINECODE0
Building Blocks
These are the operational concepts behind the system. Understanding them helps you operate correctly.
| Block | What It Does | Implementation |
|---|
| Drop Box | One frictionless capture point | Everything goes to thoughts first |
| Sorter |
AI classification + routing | LLM classifies type, then routes to structured table |
|
Form | Consistent data contracts | Each table has a defined schema |
|
Filing Cabinet | Source of truth per category |
people,
projects,
ideas,
admin tables |
|
Bouncer | Confidence threshold | confidence < 0.6 = don't route, stay in inbox |
|
Receipt | Audit trail |
thoughts row logs what came in, where it went |
|
Tap on the Shoulder | Proactive surfacing | Daily digest queries (application layer) |
|
Fix Button | Agent-mediated corrections | Move records between tables on user request |
Full conceptual framework: INLINECODE7
Five Tables
| Table | Role | Key Fields |
|---|
| INLINECODE8 | Inbox Log / audit trail | content, embedding, metadata (type, topics, people, confidence, routedto) |
| INLINECODE9 |
Relationship tracking | name (unique), context, followups, tags, embedding |
|
projects | Work tracking | name, status, next_action, notes, tags, embedding |
|
ideas | Insight capture | title, summary, elaboration, topics, embedding |
|
admin | Task management | name, due_date, status, notes, embedding |
Every table has semantic search via its own match_* function. Cross-table search via search_all.
Routing Rules
When a thought is classified:
| Type | Route | Action |
|---|
| INLINECODE15 | INLINECODE16 | Upsert: create person or append to existing context |
| INLINECODE17 |
admin | Insert new task (status=pending) |
|
idea |
ideas | Insert new idea |
|
observation | none | Stays in thoughts only |
|
reference | none | Stays in thoughts only |
If confidence < 0.6, don't route. Leave in thoughts, tell user.
Quick Start
Capture a thought (full pipeline)
CODEBLOCK0
Full pipeline with routing logic: INLINECODE23
Semantic search (single table)
CODEBLOCK1
Cross-table search
CODEBLOCK2
Returns table_name, record_id, label, detail, similarity, created_at from all tables.
List active projects
CODEBLOCK3
List pending tasks
CODEBLOCK4
Ingest Pipeline
When content arrives from any source:
- 1. Embed the text via OpenRouter (1536-dim vector)
- Classify via OpenRouter LLM (type, topics, people, confidence, suggested route)
- Log in
thoughts (the Receipt — always, regardless of routing) - Bounce check — if confidence < 0.6, stop here
- Route to structured table based on type (the Sorter)
- Confirm to the user what was captured and where it was filed
Full pipeline details: INLINECODE31
Metadata Schema
Every thought gets classified with:
| Field | Type | Values |
|---|
| INLINECODE32 | string | INLINECODE33 , task, idea, reference, INLINECODE37 |
| INLINECODE38 |
string[] | 1-3 short topic tags (always at least one) |
|
people | string[] | People mentioned (empty if none) |
|
action_items | string[] | Implied to-dos (empty if none) |
|
dates_mentioned | string[] | Dates in YYYY-MM-DD format (empty if none) |
|
source | string | Where it came from:
slack,
signal,
cli,
manual, etc. |
|
confidence | float | LLM classification confidence (0-1). The Bouncer uses this. |
|
routed_to | string | Which table the thought was filed into (null if unrouted) |
|
routed_id | string | UUID of the record in the destination table (null if unrouted) |
References
- - Conceptual framework: INLINECODE50
- First-time setup: INLINECODE51
- Database schema (SQL): INLINECODE52
- Ingest pipeline details: INLINECODE53
- Retrieval operations: INLINECODE54
- OpenRouter API patterns: INLINECODE55
Env Vars
| Variable | Service |
|---|
| INLINECODE56 | Supabase project REST base URL |
| INLINECODE57 |
Supabase auth (full access) |
|
OPENROUTER_API_KEY | OpenRouter API key |
Security Notes
Why service_role key? Supabase provides two keys: anon (public, respects RLS) and service_role (full access, bypasses RLS). This skill uses service_role because:
- - This is a single-user personal knowledge base, not a multi-tenant app
- Your agent IS the trusted server-side component
- The RLS policy restricts access to
service_role only — the most restrictive option - Using the
anon key would require loosening RLS to allow anonymous access to your thoughts, which is worse
Data sent to OpenRouter: All captured text (thoughts, names, action items) is sent to OpenRouter for embedding and classification. This is inherent to the design — you need AI to understand meaning. Don't capture highly sensitive information unless you accept OpenRouter's data handling policies.
Key handling: Store SUPABASE_SERVICE_ROLE_KEY and OPENROUTER_API_KEY securely. Never commit them to public repos. Rotate periodically. In OpenClaw, store them in openclaw.json under skills.entries or as environment variables.
Built by Limited Edition Jonathan • natebjones.com
Nate Jones 第二大脑
当智能变得丰富时,上下文成为稀缺资源。这项技能是上下文架构——一个持久化、可搜索的知识层,将你的智能体转变为个人知识管理器。
两个核心基础组件:
- - Supabase — 你的数据库,功能远不止于此。PostgreSQL + pgvector。以结构化数据形式存储想法、人物、项目、创意和任务,并附带向量嵌入。内置REST API。你的数据,你的基础设施。模型来来去去;你的上下文持久留存。一旦你拥有了Supabase项目,你就解锁了构建其他一切所需的基础——第二大脑只是开始。
- OpenRouter — 你的AI网关。一个API密钥,所有模型。用于分类和路由的嵌入和LLM调用。通过更改字符串即可切换模型。设计上面向未来。
其他一切——你如何捕捉想法、如何检索它们、你在其上构建什么——都是应用层。这项技能涵盖了基础。
如果表还不存在,请参阅 {baseDir}/references/setup.md
构建模块
这些是系统背后的操作概念。理解它们有助于你正确操作。
| 模块 | 功能 | 实现方式 |
|---|
| 收件箱 | 一个无摩擦的捕捉点 | 所有内容首先进入 thoughts |
| 分类器 |
AI分类+路由 | LLM分类类型,然后路由到结构化表 |
|
表单 | 一致的数据契约 | 每个表都有定义的架构 |
|
文件柜 | 每个类别的真实来源 | people、projects、ideas、admin 表 |
|
门卫 | 置信度阈值 | confidence < 0.6 = 不路由,留在收件箱 |
|
收据 | 审计追踪 | thoughts 行记录输入内容和去向 |
|
提醒 | 主动呈现 | 每日摘要查询(应用层) |
|
修正按钮 | 智能体介导的修正 | 根据用户请求在表之间移动记录 |
完整概念框架:{baseDir}/references/concepts.md
五个表
| 表 | 角色 | 关键字段 |
|---|
| thoughts | 收件箱日志/审计追踪 | content, embedding, metadata (type, topics, people, confidence, routedto) |
| people |
关系追踪 | name (唯一), context, followups, tags, embedding |
| projects | 工作追踪 | name, status, next_action, notes, tags, embedding |
| ideas | 洞察捕捉 | title, summary, elaboration, topics, embedding |
| admin | 任务管理 | name, due_date, status, notes, embedding |
每个表通过自身的 match* 函数实现语义搜索。通过 searchall 实现跨表搜索。
路由规则
当想法被分类时:
| 类型 | 路由 | 操作 |
|---|
| person_note | people | 更新插入:创建人物或追加到现有上下文 |
| task |
admin | 插入新任务(status=pending) |
| idea | ideas | 插入新创意 |
| observation | 无 | 仅留在 thoughts 中 |
| reference | 无 | 仅留在 thoughts 中 |
如果置信度 < 0.6,不路由。留在 thoughts 中,告知用户。
快速开始
捕捉想法(完整流程)
bash
1. 嵌入
EMBEDDING=$(curl -s -X POST https://openrouter.ai/api/v1/embeddings \
-H Authorization: Bearer $OPENROUTER
APIKEY \
-H Content-Type: application/json \
-d {model: openai/text-embedding-3-small, input: Sarah提到她正在考虑离职创业做咨询} \
| jq -c .data[0].embedding)
2. 分类(与步骤1并行执行)
METADATA=$(curl -s -X POST https://openrouter.ai/api/v1/chat/completions \
-H Authorization: Bearer $OPENROUTER
APIKEY \
-H Content-Type: application/json \
-d {model: openai/gpt-4o-mini, response
format: {type: jsonobject}, messages: [{role: system, content: 从捕捉的想法中提取元数据。返回JSON,包含:type (observation/task/idea/reference/person
note), topics (1-3个标签), people (数组), actionitems (数组), dates
mentioned (数组), confidence (0-1), suggestedroute (people/projects/ideas/admin/null), extracted_fields (目标表的结构化数据)。}, {role: user, content: Sarah提到她正在考虑离职创业做咨询}]} \
| jq -r .choices[0].message.content)
3. 存储到 thoughts(收据)
curl -s -X POST $SUPABASE_URL/rest/v1/thoughts \
-H apikey: $SUPABASE
SERVICEROLE_KEY \
-H Authorization: Bearer $SUPABASE
SERVICEROLE_KEY \
-H Content-Type: application/json \
-H Prefer: return=representation \
-d [{\content\: \Sarah提到她正在考虑离职创业做咨询\, \embedding\: $EMBEDDING, \metadata\: $METADATA}]
4. 根据分类结果路由(如果置信度 >= 0.6)
完整路由逻辑流程:{baseDir}/references/ingest.md
语义搜索(单表)
bash
QUERY_EMBEDDING=$(curl -s -X POST https://openrouter.ai/api/v1/embeddings \
-H Authorization: Bearer $OPENROUTERAPIKEY \
-H Content-Type: application/json \
-d {model: openai/text-embedding-3-small, input: 职业变化} \
| jq -c .data[0].embedding)
curl -s -X POST $SUPABASEURL/rest/v1/rpc/matchthoughts \
-H apikey: $SUPABASESERVICEROLE_KEY \
-H Authorization: Bearer $SUPABASESERVICEROLE_KEY \
-H Content-Type: application/json \
-d {\queryembedding\: $QUERYEMBEDDING, \matchthreshold\: 0.5, \matchcount\: 10, \filter\: {}}
跨表搜索
bash
curl -s -X POST $SUPABASEURL/rest/v1/rpc/searchall \
-H apikey: $SUPABASESERVICEROLE_KEY \
-H Authorization: Bearer $SUPABASESERVICEROLE_KEY \
-H Content-Type: application/json \
-d {\queryembedding\: $QUERYEMBEDDING, \matchthreshold\: 0.5, \matchcount\: 20}
从所有表返回 tablename、recordid、label、detail、similarity、created_at。
列出活跃项目
bash
curl -s $SUPABASEURL/rest/v1/projects?status=eq.active&select=name,nextaction,notes&order=updated_at.desc \
-H apikey: $SUPABASESERVICEROLE_KEY \
-H Authorization: Bearer $SUPABASESERVICEROLE_KEY
列出待处理任务
bash
curl -s $SUPABASEURL/rest/v1/admin?status=eq.pending&select=name,duedate,notes&order=due_date.asc \
-H apikey: $SUPABASESERVICEROLE_KEY \
-H Authorization: Bearer $SUPABASESERVICEROLE_KEY
摄入流程
当内容从任何来源到达时:
- 1. 嵌入 通过OpenRouter对文本进行向量化(1536维向量)
- 分类 通过OpenRouter LLM(类型、主题、人物、置信度、建议路由)
- 记录 到 thoughts(收据——无论是否路由,始终记录)
- 门卫检查 — 如果置信度 < 0.6,在此停止
- 路由 根据类型到结构化表(分类器)
- 确认 向用户确认捕捉了什么以及归档到哪里
完整流程详情:{baseDir}/references/ingest.md
元数据架构
每个想法都被分类为: