Brain Map Visualizer
The Brain Map Visualizer renders your agent's cognition as an interactive force-directed graph organized around Attention Pockets — project-level groupings that define how files relate to each other in context.
Markdown files are nodes. Sessions build the lines. The graph reflects not just which files were accessed, but which files were accessed together, and in what project context. A file that is central in one Attention Pocket may be peripheral in another. That context-dependence is the core insight the graph exposes.
First click on any node reorbits the graph around it: the layout reorganizes to show that file's cognitive neighborhood within its Attention Pocket. Nearby nodes share frequent co-access in the same sessions. Distant nodes rarely overlap. Second click opens the file.
The graph also surfaces Emerging Projects — recurring concepts detected across session journals that have not yet been mapped to a named Attention Pocket. These appear as a separate dimmed section with a Promote action.
Works for any OpenClaw agent with a vault of markdown files and a session journal history.
What This Skill Builds
A D3.js force-directed graph embedded in a React component, designed for any Next.js dashboard app or standalone React host. The skill parses session journals to extract co-access relationships between vault files, attributes those relationships to Attention Pockets, and renders them as an interactive graph.
Nodes — every markdown file in your vault, grouped and color-coded by Attention Pocket.
Lines — co-access relationships between files. A line exists when two files appear in the same session journal. Line weight reflects how many sessions they were co-accessed. Session type (planning, coding, publishing, etc.) is auto-classified from journal keywords and encoded as line color.
Graph behavior — the layout reflects attention flow and session patterns. Files that are co-accessed frequently in the same project context stay close. Files with weak or no shared context drift apart and dim.
Reorbit — first click on any node shifts the graph from project view to file-centric cognitive view centered on that node. The rest of the graph reorganizes by co-access strength relative to that file.
Emerging Projects — concepts appearing in 3 or more session journals that are not yet mapped to a named Attention Pocket surface automatically as candidates for promotion.
Attention Model
Attention Pocket
A project-level grouping of files based on active focus and session attribution. Attention Pockets are color-coded in the graph and represent distinct cognitive domains (Core Identity, Memory, Publishing, Infrastructure, Skills, General). A file belongs to the Attention Pocket that its directory structure maps to.
Session Influence
The graph structure is built from repeated co-access across sessions, not from single-session snapshots. A strong line between two files means they have appeared together across multiple sessions in similar project contexts. The graph is a cumulative record of where attention has been, not a real-time snapshot.
Context-Dependence
The same file can occupy different positions depending on the active Attention Pocket. working.md may be the gravitational center of a project-focused view and peripheral in a memory-focused view. This is expected behavior. The reorbit interaction makes this visible.
Reorbit Interaction
The graph has two interaction modes: project view and file-centric view.
Project view (default)
All nodes rendered with full weight according to global co-access frequency. Color-coded by Attention Pocket.
First click — reorbit
Clicking any node does not open the file. It recenters the graph around that node and reorganizes all other nodes based on co-access strength relative to the selected node:
- - Strongly co-accessed nodes pull close
- Weakly co-accessed nodes drift outward and dim
- The surrounding cluster is that file's cognitive neighborhood within its Attention Pocket
This shift reveals how a file behaves in context, not just how often it is accessed.
Second click — open file
Clicking the already-focused node opens its contents in the reader panel. The graph resets to project view when the reader panel closes.
Click different node while focused
Refocuses to the new node without resetting first.
The reorbit model means clicking is never destructive to the current view. Project view is always one close-reader-panel action away from restoration.
Emerging Projects and Promotion
On each graph rebuild, the journal parser scans session summary text for recurring phrases that do not map to any existing Attention Pocket.
Detection rule: A concept or phrase appearing in 3 or more session journals is flagged as Emerging. The detection threshold is tunable via a config parameter in the parser script.
Weight: Mentions in journal summaries carry more weight than incidental file access patterns. A phrase appearing once in a summary counts more than a phrase inferred from file path co-occurrence.
UI behavior:
- - Emerging concepts appear in a separate Emerging Projects section below the main graph
- Nodes in this section are visually dimmed relative to active Attention Pocket nodes
- Each Emerging entry includes a Promote action
Promotion:
- - User names the concept and assigns it as a new Attention Pocket
- On the next rebuild, files matching the new pocket's pattern are grouped and color-coded accordingly
- The Emerging entry is removed from the dimmed section
Promotion is a local configuration write. No external calls. The result is a new named color group in the graph on the next data refresh.
Feature List
Attention Centering
The graph layout reflects project-level attention allocation. Files that absorb more session activity in a given pocket are weighted toward the center of that pocket's cluster.
Reorbit Interaction
First click reorganizes the graph around the selected node's cognitive neighborhood. Second click opens the file. The distinction between exploring context (click one) and reading content (click two) is intentional.
Color-coded Attention Pockets
Six named pockets, each with a distinct color: Core Identity (gold), Memory (purple), Publishing (green), Infrastructure (blue), Skills (orange), General (gray).
Enhanced Tooltips
Node hover: file path, access count, Attention Pocket, number of co-access sessions. Line hover: session type, source/target names, co-access count, session dates.
Emerging Projects Panel
Automatically surfaced from journal scanning. Dimmed, named, promotable. No manual curation required to surface new patterns.
Line Filter
Toggle minimum co-access weight threshold (default 2x, options: all / 2x / 3x / 5x). Reduces visual noise on dense graphs.
Graph Freeze
When the simulation cools, nodes lock in place. No ongoing jitter. Drag to reposition any node; it releases on mouse-up.
Single-click Node Open
In project view, single click opens the node's file. In reorbit mode (focused view), single click is reserved for reorbit. Second click opens.
Rebuild Button
Wired to the parser API endpoint. Triggers a full journal rescan and graph data refresh. Shows spinner and status feedback.
Prerequisites
- - OpenClaw agent with a vault directory containing markdown files
- Session journals in
memory/journal/YYYY-MM-DD.md format (each entry references vault files) - A Next.js dashboard app or equivalent React host — or serve standalone with INLINECODE2
- Node.js 18+ for the data extraction script
- INLINECODE3 and
@types/d3 installed in your frontend project
Bootstrapping Without Journal History
If you have been running an agent but have not written structured journal files, bootstrap from session history:
Pull session transcripts or conversation logs, run them through a summarization script, and output one memory/journal/YYYY-MM-DD.md per session. The parser only needs .md file references in the text. Format does not matter.
Bootstrap prompt for your agent:
"Read my session history from [source] and generate a journal entry for each session at memory/journal/YYYY-MM-DD.md. Summarize what we worked on and list the markdown files we accessed."
The graph builds from whatever journal history exists and gets richer over time as more sessions are logged.
Installation
Step 1 — Copy the data extraction script
Copy references/journal-parser.md into a Node.js script at scripts/build-brain-map.js in your workspace. Adjust VAULT_DIR and OUTPUT_PATH via environment variables if needed.
Run it:
CODEBLOCK0
Step 2 — Wire the API route
In your Next.js app, add the API route from references/graph-schema.md. It serves brain-map-graph.json with no caching:
CODEBLOCK1
Step 3 — Add the React component
Copy BrainMapGraph.tsx from references/component.md into your components/ directory:
CODEBLOCK2
Step 4 — Rebuild graph data
Run the parser script any time to refresh the graph. Add it to a cron job for weekly updates:
CODEBLOCK3
Graph Data Format
See references/graph-schema.md for the full spec.
CODEBLOCK4
Attention Pockets — Color Mapping
| Pocket | Color | Files |
|---|
| Core Identity | Gold INLINECODE18 | MEMORY.md, SOUL.md, USER.md, IDENTITY.md, AGENTS.md, TOOLS.md |
| Memory |
Purple
#a78bfa | memory/*.md |
| Publishing | Green
#22c55e | PublishingPipeline/
, drafts/ |
| Infrastructure | Blue
#60a5fa | tools/
, workflows/, prompts/
, scripts/ |
| Skills | Orange
#f97316 | skills/* |
| General | Gray
#6b7280 | Everything else |
Line Colors — Session Type
Session type is auto-classified from journal text keywords:
| Session Type | Color | Keywords |
|---|
| Strategy / Planning | Gold | strategy, roadmap, planning, product, business |
| Memory / Identity |
Purple | memory, identity, voice, self |
| Publishing / Content | Green | publish, article, draft, content |
| Infrastructure / Code | Blue | deploy, build, API, route, server, cron |
| Research / Analysis | Orange | research, analysis, audit, skill |
| General / Mixed | Gray | fallback |
Security
Scope: The skill reads markdown files in your vault directory and session journals to build a graph. It writes one JSON file (brain-map-graph.json) as output. No network calls are made beyond fetching graph data from your own local API route. No credentials are requested, stored, or transmitted.
Filesystem access: The journal parser reads .md files recursively under your configured vault directory and writes one output file. Scope is intentional and bounded. Run the parser only from a trusted working directory.
Tooltip rendering: The graph component renders tooltips as structured React elements (filename, group, session counts). Tooltips use structured React elements only — no raw HTML injection.
Emerging Projects scan: The journal parser reads existing session journal summaries to detect recurring phrases. This is the same local read scope as the existing co-access scan. No new file system paths are accessed. No writes occur beyond the single output JSON.
Promotion writes: When a user promotes an Emerging concept to a named Attention Pocket, the result is a local configuration write within the parser's existing output scope. No external calls.
API route access: The route serving graph data is open by default, suitable for localhost development. For networked deployments, add your own middleware-level access control in your Next.js app (e.g., session-based auth or a reverse-proxy layer). No API keys or credentials are required by this skill.
Known Limitations
- - Journal summaries reference files inconsistently — graph data improves as journaling explicitly names files.
- Graph rebuilds are not real-time; run the parser script to refresh.
- Reader panel (second click to open file) requires a
/api/read-file endpoint in the host app. - Emerging Projects detection depends on journal summary quality. Sparse summaries produce fewer signals.
References
- -
references/journal-parser.md — Node.js script to extract co-access data and detect Emerging Projects - INLINECODE28 — Full
BrainMapGraph.tsx React + D3 component - INLINECODE30 — Graph JSON spec and Next.js API route
License
MIT. Copyright (c) 2026 @highnoonoffice. Retain this notice in any distributed version.
脑图可视化器
脑图可视化器将您的智能体认知呈现为一个交互式力导向图,该图围绕注意力口袋(Attention Pockets)组织——这些是项目级分组,定义了文件在上下文中的相互关系。
Markdown文件是节点。会话构建连线。该图不仅反映了哪些文件被访问过,还反映了哪些文件被一起访问,以及在什么项目上下文中被访问。在一个注意力口袋中处于中心位置的文件,在另一个口袋中可能处于边缘位置。这种上下文依赖性正是该图所揭示的核心洞见。
首次点击任意节点会围绕该节点重新调整图形布局:布局会重新组织,以显示该文件在其注意力口袋中的认知邻域。附近的节点在同一会话中具有频繁的共同访问记录。远处的节点则很少重叠。第二次点击会打开该文件。
该图还会呈现新兴项目(Emerging Projects)——在会话日志中检测到的重复出现但尚未映射到命名注意力口袋的概念。这些内容会作为一个单独的暗淡区域出现,并带有提升(Promote)操作。
适用于任何拥有Markdown文件仓库和会话日志历史的OpenClaw智能体。
该技能构建的内容
一个嵌入在React组件中的D3.js力导向图,专为任何Next.js仪表板应用或独立的React宿主设计。该技能解析会话日志以提取仓库文件之间的共同访问关系,将这些关系归因于注意力口袋,并将其渲染为交互式图形。
节点 — 仓库中的每个Markdown文件,按注意力口袋分组并用颜色编码。
连线 — 文件之间的共同访问关系。当两个文件出现在同一会话日志中时,就会存在一条连线。连线粗细反映了它们被共同访问的会话数量。会话类型(规划、编码、发布等)会根据日志关键词自动分类,并编码为连线颜色。
图形行为 — 布局反映了注意力流动和会话模式。在同一项目上下文中频繁共同访问的文件会保持靠近。共享上下文薄弱或没有共享上下文的文件会相互远离并变暗。
重新调整 — 首次点击任意节点会将图形从项目视图切换到以该节点为中心的文件中心认知视图。图形的其余部分会根据与该文件的共同访问强度重新组织。
新兴项目 — 出现在3个或更多会话日志中但尚未映射到命名注意力口袋的概念会自动浮现,作为可提升的候选对象。
注意力模型
注意力口袋
基于主动关注和会话归属的项目级文件分组。注意力口袋在图中用颜色编码,代表不同的认知领域(核心身份、记忆、发布、基础设施、技能、通用)。文件属于其目录结构映射到的注意力口袋。
会话影响
图形结构建立在跨会话的重复共同访问基础上,而非单一会话的快照。两个文件之间的强连线意味着它们在多个会话中出现在相似的项目上下文中。该图是注意力去向的累积记录,而非实时快照。
上下文依赖性
同一文件可以根据活跃的注意力口袋占据不同的位置。working.md可能是项目聚焦视图的重力中心,但在记忆聚焦视图中则可能处于边缘位置。这是预期行为。重新调整交互使这一点变得可见。
重新调整交互
该图有两种交互模式:项目视图和文件中心视图。
项目视图(默认)
所有节点根据全局共同访问频率以完整权重渲染。按注意力口袋用颜色编码。
首次点击 — 重新调整
点击任意节点不会打开文件。它会围绕该节点重新居中图形,并根据与所选节点的共同访问强度重新组织所有其他节点:
- - 强共同访问节点会拉近
- 弱共同访问节点会向外漂移并变暗
- 周围的集群是该文件在其注意力口袋中的认知邻域
这种转变揭示了文件在上下文中的行为方式,而不仅仅是它被访问的频率。
第二次点击 — 打开文件
点击已聚焦的节点会在阅读器面板中打开其内容。当阅读器面板关闭时,图形会重置为项目视图。
在聚焦状态下点击不同节点
会重新聚焦到新节点,而无需先重置。
重新调整模型意味着点击永远不会破坏当前视图。项目视图始终只需一次关闭阅读器面板的操作即可恢复。
新兴项目与提升
在每次图形重建时,日志解析器会扫描会话摘要文本,查找不映射到任何现有注意力口袋的重复短语。
检测规则: 出现在3个或更多会话日志中的概念或短语会被标记为新兴。检测阈值可通过解析器脚本中的配置参数进行调整。
权重: 日志摘要中的提及比偶然的文件访问模式具有更高的权重。在摘要中出现一次的短语比从文件路径共现推断出的短语权重更高。
UI行为:
- - 新兴概念会出现在主图下方的独立新兴项目区域中
- 该区域中的节点相对于活跃注意力口袋节点在视觉上变暗
- 每个新兴条目都包含一个提升操作
提升:
- - 用户命名该概念并将其分配为新的注意力口袋
- 在下一次重建时,匹配新口袋模式的文件会相应分组并用颜色编码
- 新兴条目会从暗淡区域中移除
提升是本地配置写入。无外部调用。结果是在下一次数据刷新时图中出现一个新的命名颜色组。
功能列表
注意力居中
图形布局反映了项目级的注意力分配。在特定口袋中吸收更多会话活动的文件会向该口袋集群的中心加权。
重新调整交互
首次点击围绕所选节点的认知邻域重新组织图形。第二次点击打开文件。探索上下文(点击一次)和阅读内容(点击两次)之间的区别是有意设计的。
颜色编码的注意力口袋
六个命名口袋,每个都有独特的颜色:核心身份(金色)、记忆(紫色)、发布(绿色)、基础设施(蓝色)、技能(橙色)、通用(灰色)。
增强工具提示
节点悬停:文件路径、访问次数、注意力口袋、共同访问会话数。连线悬停:会话类型、源/目标名称、共同访问次数、会话日期。
新兴项目面板
自动从日志扫描中浮现。暗淡、命名、可提升。无需手动整理即可浮现新模式。
连线过滤器
切换最小共同访问权重阈值(默认2倍,选项:全部/2倍/3倍/5倍)。减少密集图上的视觉噪音。
图形冻结
当模拟冷却时,节点锁定到位。无持续抖动。拖动可重新定位任意节点;鼠标释放时松开。
单击节点打开
在项目视图中,单击可打开节点的文件。在重新调整模式(聚焦视图)中,单击保留用于重新调整。第二次点击打开。
重建按钮
连接到解析器API端点。触发完整的日志重新扫描和图形数据刷新。显示旋转器和状态反馈。
先决条件
- - 拥有包含Markdown文件的仓库目录的OpenClaw智能体
- 格式为memory/journal/YYYY-MM-DD.md的会话日志(每个条目引用仓库文件)
- Next.js仪表板应用或等效的React宿主——或使用npx serve独立运行
- 用于数据提取脚本的Node.js 18+
- 前端项目中安装了d3和@types/d3
无日志历史时的引导
如果您一直在运行智能体但未编写结构化日志文件,请从会话历史中引导:
获取会话记录或对话日志,通过摘要脚本运行它们,并为每个会话输出一个memory/journal/YYYY-MM-DD.md。解析器只需要文本中的.md文件引用。格式不重要。
为您的智能体提供的引导提示:
从[来源]读取我的会话历史,并为每个会话在memory/journal/YYYY-MM-DD.md生成一个日志条目。总结我们完成的工作,并列出我们访问过的markdown文件。
该图从任何存在的日志历史构建,并随着更多会话被记录而随时间变得更加丰富。
安装
步骤1 — 复制数据提取脚本
将references/journal-parser.md复制到工作区中的Node.js脚本scripts/build-brain-map.js。如果需要,通过环境变量调整VAULTDIR和OUTPUTPATH。
运行它:
bash
node scripts/build-brain-map.js
步骤2 — 连接API路由
在您的Next.js应用中,从references/graph-schema.md添加API路由。它提供brain-map-graph.json,无缓存:
app/api/brain-map/graph/route.ts
步骤3 — 添加React组件
将BrainMapGraph.tsx从references/component.md复制到您的components/目录中:
tsx
import BrainMapGraph from @/components/BrainMapGraph;
export default function BrainMapTab() {
return ;
}
步骤4 — 重建图形数据
随时运行解析器脚本以刷新图形。将其添加到cron作业以进行每周更新:
bash
每周脑图重建(周日午夜)
0 0
0 cd /path/to/vault && node scripts/build-brain-map.js
图形数据格式
完整规范请参见references/graph-schema.md。
json
{
nodes: [
{ id: MEMORY.md, group: core, accessCount: 7, path: MEMORY.md }
],
lines: [
{
source: MEMORY.md,
target: memory/recent.md,
weight: 5,
sessionType: memory,
sessions: [2026-03-14