chat-agent-spec

chat-agent-spec is an agent for coding agents from labilezhu/everlingo. It costs 0 tokens per session (5,583 once invoked), scanned A, original, MIT.

A specification for a chatbot agent that uses a LangChain agent to understand messages, perform actions, and write replies. LangChain is a framework for connecting language models with tools.

In plain words
What is it for?
Supporting word lookups, translation, language-learning questions, configuration reads, and reading, creating, editing, or deleting notes.
Why use it?
It keeps user-intent handling in the agent rather than hard-coding every decision in application code.

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/labilezhu/everlingo/chat-agent-spec
Clone the repo
git clone --depth 1 https://github.com/labilezhu/everlingo

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for chat-agent-spec

README.md
[![agentmods](https://agentmods.dev/badge/agents/labilezhu/everlingo/chat-agent-spec.svg)](https://agentmods.dev/agents/labilezhu/everlingo/chat-agent-spec)
Your own site
<a href="https://agentmods.dev/agents/labilezhu/everlingo/chat-agent-spec"><img src="https://agentmods.dev/badge/agents/labilezhu/everlingo/chat-agent-spec.svg" alt="Measured on agentmods" height="20"></a>
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 5,583 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.05583
Opus 5 $0.00000 $0.02792
Sonnet 5 $0.00000 $0.01117
Haiku 4.5 $0.00000 $0.00558

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

Security

Grade A, and why

chat-agent-spec 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 5d 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/impl-spec/agents/chat-agent-spec.md · 339 lines

How it starts

The opening of the file, as written. The whole thing — 339 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Chat Agent

应实现于: /src/everlingo/agents/agent.py ,主要实现在 class MainAgent

Chatbot 中处理用户输入的消息,均应该使用 langchain 的 agent 去处理。

这里的 langchain 的 agent , 可由类似以下的代码来创建:

from langchain.agents import create_agent

agent = create_agent("openai:gpt-5.5", tools=tools)

用户意图分析、执行、回复响应

用户意图的分析,应该交由 LLM / langchain agent 去判断,而不是代码实现。

envelope.task 的作用

envelope 的 task 字段表达用户偏好的任务(translate / look_up / none), 是偏好而非命令。即使 task=translate,用户仍可追问其他问题,LLM 应按消息实际内容识别意图。 task 仅作为优先级提示:look_up 偏向查单词,translate 偏向翻译,none 不影响意图识别。

用户意图类型 按识别优先级从高到低分为(与 system prompt agent.py_build_system_prompt() 一致):

  1. 查单词
  2. 翻译
  3. 语言学习问题智能问答
  4. 管理 USER.md
  5. 查询配置(只读;禁止修改 everlingo.yaml
  6. 未识别输入
  7. 笔记读取和浏览
  8. 抽取对话内容到笔记
  9. 笔记删除
  10. 笔记编辑

其中 #8 走异步 request_memory_extraction 工具(见下文「记忆抽取触发」节);#9 / #10 走同步 memory_writer_action 工具(见下文「笔记删除与编辑」节)。

Agent 的用户意图分析用户意图的执行与回复响应 见 Agent 的 system prompt: src/everlingo/agents/agent.py 中的 _build_system_prompt()

结构化用户输入(envelope)(2026-07)

system prompt 在 ## 用户意图分类 之前新增 ## 结构化用户输入(envelope) 节,说明 <envelope> 标签包裹的 JSON 输入格式及各字段含义。所有 Channel 统一产 UserInputEnvelope(详见 envelope-spec.md),LLM 看到的用户消息始终是 {envelope} 序列化格式。

本地加载:envelope schema 是 agent 输入契约(代码资产),在 _refresh_agent_if_needed() 中从 src/everlingo/agents/spec/ 包本地加载(PackageSource("everlingo.agents.spec") + compile_prompt),经 shift_headings(+2) 后注入到 ## 结构化用户输入(envelope) 节(h1→h3 嵌套于外层 h2 之下)。不依赖 vault 在线,无兜底需求。

该节附加一条延续语义规则:当 task=look_upchat.message 为空且 chat_context.resource_contexts 不含 selected_text 项时,视为"延续上一轮笔记话题"——LLM 不应回复"未收到输入",而应基于对话历史继续推进相关工作(如读取/编辑上一轮提到的笔记)。该规则同时写入 agent.py system prompt。

invoke -> ainvoke

MainAgent.invoke 为 async 方法 ainvoke,因为 MCP 工具(vault 只读)需要异步 session。 Session.runawait self.agent.ainvoke(...) 调用。

system prompt 构造

system prompt 刷新

由于 system prompt 使用了 User Profile 与 用户自由偏好笔记 (USER.md) 。而用户/Agent 可能动态修改它们。所以 system prompt 也要刷新。

Read the full file on GitHub · 339 lines

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. 5d ago First seen · 339 lines · 0 tokens per session scan A 2142a4f66298

Subscribe to this mod's changes

chat-agent-spec is an agent published in the GitHub repository labilezhu/everlingo (12 stars, last pushed 10d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 5,583 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.