knowledge-structure

A guide to organising a shared knowledge base for software agents. It describes folders for lessons and reference documents, search scripts, automatic reloading, and ways different agents can receive this information.

In plain words
What is it for?
Store troubleshooting notes and complete technical plans, search them by keyword or document type, and connect the knowledge base to agent workflows.
Why use it?
It gives teams a consistent place to record solutions, mistakes, and design details so agents can find them later.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/ikalus1988/misakanet/knowledge-structure
Clone the repo
git clone --depth 1 https://github.com/Ikalus1988/MisakaNet
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 568 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00568
Opus 5 $0.00000 $0.00284
Sonnet 5 $0.00000 $0.00114
Haiku 4.5 $0.00000 $0.00057

Measured 2d ago against content hash f2e31c0caa9a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

knowledge-structure scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

docs/agents/knowledge-structure.md · 71 lines

What it actually says

知识库结构指南

目录结构

MisakaNet/
├── lessons/                  # 跨节点共享知识(踩坑记录)
├── reference/                # 完整方案文档
├── misakanet/                # 通信模块
│   ├── scripts/
│   │   ├── queue_lesson.py       # 写 lesson
│   │   ├── search_knowledge.py   # 检索知识
│   │   └── ...
│   └── schema/
├── storage/
│   ├── knowledge_graph.py   # 知识图谱
│   └── vector_store.py      # 向量存储
└── docs/agents/              # 代理操作指南
    ├── retrieval-and-contribution.md
    ├── knowledge-structure.md
    └── node-injection.md

lessons/ 目录

存放踩坑记录,格式:

  • 文件名:领域-问题描述.md
  • 内容:问题→根因→修复→验证
  • 长度:几百字

reference/ 目录

存放完整方案,格式:

  • 文件名:项目-方案描述.md
  • 内容:需求→规划→代码→上下文
  • 长度:几千字

检索系统

search_knowledge.py

# 检索所有
python3 search_knowledge.py "关键词"

# 只看 lessons
python3 search_knowledge.py "关键词" --lessons

# 只看 reference
python3 search_knowledge.py "关键词" --ref

# 只看标题
python3 search_knowledge.py "关键词" --titles

索引机制

  • lessons/ 和 reference/ 通过 inotify 热加载
  • 知识图谱存储在 storage/knowledge_graph.py
  • 向量存储在 storage/vector_store.py

节点注入规则

节点类型 方式 说明
Hermes CLI CLAUDE.md 本仓库 CLAUDE.md 已包含规则
cc-haha PostToolUseFailure 钩子 Bash 失败时自动 grep lessons/
原生 Claude Code 项目 CLAUDE.md 在每个项目根目录放 CLAUDE.md
云 Agent 启动 prompt / SOUL.md 每次会话开始 fetch lessons 并调用 search_knowledge.py
OpenClaw CLAUDE.md + cron 同 Hermes
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 71 lines · 0 tokens per session scan A f2e31c0caa9a

Subscribe to this mod's changes

knowledge-structure is an agent published in the GitHub repository Ikalus1988/MisakaNet (432 stars, last pushed 2d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 568 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.