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.
npx agentmods add agents/netmindai-open/narranexus/awareness.pygit clone --depth 1 https://github.com/NetMindAI-Open/NarraNexusWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.00661 |
| Opus 5 | $0.00000 | $0.00331 |
| Sonnet 5 | $0.00000 | $0.00132 |
| Haiku 4.5 | $0.00000 | $0.00066 |
Grade A, and why
awareness.py 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 3d 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.
What it actually says
agents/awareness.py — Agent Awareness 读写路由
为什么存在
Awareness 是 Agent 的自我认知配置——它知道自己是谁、有什么能力、适用于哪些场景。这些信息存储在 instance_awareness 表里,通过 AwarenessModule 的实例 ID 关联到 Agent。这个路由文件暴露 GET/PUT 两个接口,让前端能读取和编辑 Awareness 内容。
上下游关系
- 被谁用:
backend/routes/agents/core.py聚合并挂载到/api/agents;前端AwarenessPanel组件 - 依赖谁:
InstanceRepository— 查询或创建AwarenessModule实例InstanceAwarenessRepository— upsert awareness 内容到instance_awareness表xyz_agent_context.utils.db.db_factory.get_db_client— 直接查询instance_awareness表读取结果
设计决策
自动创建实例的 _ensure_awareness_instance
这个路由的一个关键设计是:如果 Agent 还没有 AwarenessModule 实例,GET 和 PUT 请求都会自动创建一个,而不是返回 404。理由是 Awareness 对每个 Agent 来说是必要的,在 Agent 创建时就应该存在,自动补齐比强迫调用者先创建实例更好用。
这个决策的代价是:GET 请求在极端情况下会有写副作用(创建实例),打破了 HTTP 语义中 GET 应该是幂等无副作用的约定。但实际上第一次 GET 之后实例就存在了,后续 GET 不会再写,所以问题有限。
分开 Repository 和直接 DB 查询
写操作用 InstanceAwarenessRepository.upsert(),读操作用 db_client.get_one() 直接查表,没有通过 Repository 封装。这是轻微的不一致,但读 Repository 的实现本质上也是 get_one,直接调没有额外风险。
Gotcha / 边界情况
- Awareness 数据不存在时 GET 返回
success=False:即使实例创建成功,如果instance_awareness表里还没有这个实例的记录(比如 Awareness 从未被写过),GET 会返回success=False, error="Awareness data not found",而不是空数据。前端需要处理这个情况,把它区别于真正的错误。 - PUT 之后立即重读:upsert 成功后会再次
get_one读取刚写入的数据并返回,这是为了确保返回值反映数据库的实际状态(比如updated_at字段由数据库生成)。
新人易踩的坑
instance_awareness 表的主键是 instance_id,而不是 agent_id。必须先通过 _ensure_awareness_instance 拿到实例 ID,再用实例 ID 查询,不能用 agent_id 直接查 instance_awareness。
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.
- 3d ago First seen · 41 lines · 0 tokens per session scan A a9a397fcca70
awareness.py is an agent published in the GitHub repository NetMindAI-Open/NarraNexus (84 stars, last pushed 9d ago), licensed Apache-2.0. It costs nothing until one of its globs matches a file; then it loads 661 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.
Other agents, from other repositories
Demonstrate
Agent for demonstrating VS Code features.
playwright-test-generator
Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.
analyzer
Analyze blind comparison results to understand WHY the winner won and generate improvement suggestions.
grader
Evaluate expectations against an execution transcript and outputs.
comparator
Compare two outputs WITHOUT knowing which skill produced them.
.NET-Notebook-Migration-Agent
Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.