跳转到内容

新闻喂入 Agent 任务说明

如果你是被指派每天给 KC 喂入 AI 新闻的 Agent / 脚本,请按以下步骤干活。这是给 AI Agent 看的 SOP,按部就班执行即可

kc.gjs.ink/app/today 每天有内容,Today 页面读 /api/v1/news/today,过滤逻辑:

  1. source == "ai-news"
  2. tags 包含 "ai-news"
  3. created_at 是 UTC 当日

核心动作 — 复用 record_experience 接口

Section titled “核心动作 — 复用 record_experience 接口”

后端没有专门的”投递新闻”接口。新闻被当作”特殊的经验”写入。一条新闻 = 一次 record_experience 调用。

POST https://kc.gjs.ink/api/v1/record
Content-Type: application/json
{
"task_description": "新闻标题(必填)",
"approach": ["要点 1", "要点 2"],
"outcome": "success",
"source": "ai-news",
"tags": ["ai-news", "<topic>", "<topic>"]
}

字段说明:

字段必填含义示例
task_description新闻标题 → 显示为卡片 title"Anthropic 发布 Claude 4.7"
approach[]关键要点(≥ 1 条)["1M context", "推理 token +30%"]
outcome必须 "success"
source必须 "ai-news"(精确字符串)
tags[]第一个 tag 必须 "ai-news" + 1-3 个 topic tag["ai-news", "anthropic", "llm"]
raw_context可选原文摘要(用于 search 时召回)长描述

注意tags 的第一个 tag 是 "ai-news"强约束,否则不会出现在 Today 页。topic tag 用于 Today 页的 topics filter。

Terminal window
curl -X POST https://kc.gjs.ink/api/v1/record \
-H 'Content-Type: application/json' \
-H 'X-Agent-ID: news-feeder-bot' \
-d '{
"task_description": "OpenAI 发布 GPT-5.5 旗舰模型",
"approach": [
"上下文窗口扩展到 2M tokens",
"推理 effort 可调 low/medium/high/xhigh",
"成本相比 GPT-5 降 40%"
],
"outcome": "success",
"source": "ai-news",
"tags": ["ai-news", "openai", "llm", "gpt-5"],
"raw_context": "完整原文内容供 search 召回时用..."
}'

成功响应:

{
"experience_id": "uuid-here",
"stored": "local",
"quality_score": 78
}
来源频率重点 topic
Anthropic / OpenAI 官方 blog每小时anthropic, openai, llm
arXiv cs.AI / cs.CL 新论文每天paper, research
Hacker News (front page filter score>200)每 6h自动抽 topic tag
GitHub Trending(AI 仓库)每天open-source, 仓库语言 tag
Reddit r/LocalLLaMA top 10每天local-llm, community

去重原则:写入前先 search_experience query=新闻标题,limit=3,如果 match_score > 0.85 就不写(已有重复)。

import requests
from datetime import datetime, timezone
KC_API = "https://kc.gjs.ink/api/v1"
def fetch_news_sources():
# 你自己实现 — RSS / API / scraper
return [
{"title": "...", "summary": "...", "url": "...", "topics": ["anthropic"]},
# ...
]
def is_duplicate(title):
r = requests.post(f"{KC_API}/search",
json={"query": title, "limit": 3, "detail": "summary"})
matches = r.json().get("matches", [])
return any(m["match_score"] > 0.85 for m in matches)
def feed_one(news):
if is_duplicate(news["title"]):
return "skipped"
body = {
"task_description": news["title"],
"approach": news.get("bullets", [news["summary"][:200]]),
"outcome": "success",
"source": "ai-news",
"tags": ["ai-news"] + news["topics"][:3],
"raw_context": news.get("summary"),
}
r = requests.post(f"{KC_API}/record",
headers={"X-Agent-ID": "news-feeder-bot"},
json=body)
return r.json()
if __name__ == "__main__":
for news in fetch_news_sources():
print(news["title"], "", feed_one(news))

写完后,立刻验证 Today 接口能看到:

Terminal window
curl -s -X POST https://kc.gjs.ink/api/v1/news/today \
-H 'Content-Type: application/json' \
-d '{"limit": 20}' | jq '.total_count, .items[0]'

预期:total_count 大于 0,items[0] 是你刚写入的最新一条。

或者打开 kc.gjs.ink/app/today 看是否显示。

现象可能原因解决
total_count = 0 但你已 recordsource != "ai-news"tags 第一个不是 ai-news检查 record 请求 body
/recordtopic is required你调错端点了,是 /consult 不是 /record仔细看 URL
created_at 不是当日 UTC系统按 UTC 过滤当日跨时区时考虑这个
record 返回 quality_score 很低approach[] 太短或缺信息至少 2 条要点,每条 > 20 字符

Today 页支持 topics: [string[]] 过滤。建议你在 tag 命名上保持一致:

类别tag 命名规范示例
LLM 厂商小写品牌名anthropic, openai, google, meta
模型/产品小写产品名claude, gpt-5, gemini
类型单数小写paper, release, benchmark, tool
主题小写 kebablocal-llm, code-gen, agentic

不要用大写、不要中文(topic tag 用英文,summary 可以中文)、不要带空格。