agentleFS
hc938456hc938456/edgartools/SKILL.md

edgartools

Skill2 starsChanged 4 months agoMITView on GitHub

仅在用户明确使用 `$edgartools`、`$EdgarTools`、`@EdgarTools`,点名 EdgarTools,或明确要求使用 EdgarTools Skill 时调用;不得因为任务涉及 SEC filings、财报或 EDGAR 而隐式触发。显式调用后,使用 EdgarTools 5.47+ 查询和分析 SEC filings,并在下载或实际读取具体报告时自动用本地脚本归档、解析和写入 SQLite/FTS5。

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Files
SKILL.md

EdgarTools

使用 EdgarTools 查询与分析 SEC filings,并将真正使用过的报告沉淀为可复用、可审计的本地证据库。

强制路由

  1. 仅查询公司、filing 列表、元数据或 URL 时,不下载、不解析。
  2. 下载、打开、阅读、搜索或分析具体 filing 内容时,将 scripts/filing_store.py ingest 作为唯一持久化下载入口;一次调用必须完成原件归档、确定性解析、SQLite 入库和 FTS5 索引。
  3. 对 6-K/6-K/A,季度业绩正文经常位于 EX-99.x 而不是 primary document。脚本必须自动保存并解析相关 HTML/TXT 附件,将附件正文和财务表格纳入 SQLite/FTS5;只解析 6-K 封面不算完成。
  4. 不要直接使用 download_filings()、download_file() 或 Filing.save() 完成面向用户的报告保存。Filing.save() 是版本耦合的 pickle,不是规范原件;download_edgar_data() 只下载元数据,不下载 filing 文档。
  5. 脚本返回紧凑 JSON 后,再使用本地 search 或 section 子命令提取受限证据。不要把整份 HTML、Markdown、submission 或完整 XBRL facts 输出到 LLM 上下文。
  6. 原件已存在且文件哈希、EdgarTools 版本和解析器版本均未变化时,先通过 SQLite、meta 和原件哈希完成本地复用判定;复用路径不得导入 EdgarTools、要求 EDGAR_IDENTITY 或访问网络。解析器或依赖版本变化时,从本地 SGML 纯离线重建派生产物和索引;只有原件缺失时才要求 identity 和网络。
  7. 解析失败时保留已下载原件并报告失败状态;不得将其表述为 ready,也不要绕开脚本直接阅读后结束。

首次下载引导

每次准备从 SEC 下载前先运行 doctor。如果返回 IDENTITY_NOT_SET,暂停下载并向用户说明:SEC 要求 User-Agent 包含姓名/组织和可联系邮箱。优先指导用户在本机设置 EDGAR_IDENTITY;不要把邮箱当作普通业务问题重复显示,也不要默认写入持久化配置。

如果用户明确愿意由 Skill 代为配置,可在当前下载进程调用 edgar.set_identity("Name or Organization contact@example.com"),或在同一个命令进程临时设置 EDGAR_IDENTITY,然后重新运行 doctor。不要在回答、日志、SQLite、Skill 文件或测试产物中回显或保存 identity。只有 download_ready=true 后才继续 ingest/ingest-many。若用户要求跨会话持久化,先明确说明写入用户环境的影响并再次获得确认;配置完成后告知用户如何清除或更换该值。

下载即自动解析

首次下载前运行只读预检;它只报告 identity 是否就绪,不回显其值,也不访问 SEC:

python .agents/skills/edgartools/scripts/filing_store.py doctor

确认 doctor 返回 download_ready=true 后,再执行归档。若返回 IDENTITY_NOT_SET,按上面的“首次下载引导”暂停并配置 identity。

python .agents/skills/edgartools/scripts/filing_store.py ingest `
  --accession "0000320193-25-000079"

同一任务选择多份 filing 时,使用一个批量进程复用 EdgarTools 与 SQLite 初始化;SEC 获取保持串行,最多 2 个 worker 受控并行解析,主线程串行提交索引:

python .agents/skills/edgartools/scripts/filing_store.py ingest-many `
  --accession "0000320193-25-000079" `
  --accession "0000320193-25-000081" `
  --workers 2

--accession 可重复,重复 accession 自动去重且结果保持首次出现顺序。默认 --workers 2;仅在内存充足且已验证环境稳定时提高,上限为 4。单份 filing 仍使用 ingest。

默认数据目录是 data/edgartools/。脚本保存 SEC full submission、HTML、纯文本和 Markdown,解析章节、表格、附件元数据及 XBRL facts,并写入 data/edgartools/index/edgartools.sqlite。对 6-K,primary.html 保留 SEC 封面,承载业绩正文的 EX-99.x 会保存到 attachments/,并额外生成可直接用浏览器打开的 analysis.html 聚合视图。表格集中写入一个 tables.jsonl,行级内容在 SQLite FTS5 中预建索引,不在查询时逐个打开 JSON。

下载完成后只向上下文返回 action、status、计数、document_id、原件路径、preferred_view_path 和数据库路径。action 区分 downloaded_and_ingested、reparsed_from_local 与 reused。涉及下载、解析、缓存、索引或失败恢复时,阅读 Local_Storage.md。

本地证据检索

# 默认最多返回 5 个、每个不超过 700 字符的证据片段
python .agents/skills/edgartools/scripts/filing_store.py search `
  --accession "0000320193-25-000079" `
  --query "revenue recognition"

# search 返回稳定 chunk_id、最短命中窗口及其中心 match_offset;围绕真实命中读取上下文
python .agents/skills/edgartools/scripts/filing_store.py context `
  --accession "0000320193-25-000079" `
  --chunk-id "<search返回值>" `
  --offset 12345

# 精确读取一个 Item/Section;默认最多返回 4,000 字符
python .agents/skills/edgartools/scripts/filing_store.py section `
  --accession "0000320193-25-000079" `
  --section-key "7"

# 精确读取受限 XBRL facts;默认排除很长的 TextBlock
python .agents/skills/edgartools/scripts/filing_store.py facts `
  --accession "0000320193-25-000079" `
  --concept "us-gaap:RevenueFromContractWithCustomerExcludingAssessedTax" `
  --concept-match exact `
  --dimensions consolidated

# 默认对同一经济口径的重复 XBRL occurrence 选择 decimals 精度最高者;审计时返回全部
python .agents/skills/edgartools/scripts/filing_store.py facts `
  --accession "0000320193-25-000079" `
  --concept "us-gaap:UnrecognizedTaxBenefits" `
  --concept-match exact `
  --duplicates all

# 6-K 等没有 XBRL facts 时,直接检索本地结构化表格行
python .agents/skills/edgartools/scripts/filing_store.py table-search `
  --accession "0001104659-26-067186" `
  --query "95 672 106 229"

# 表格数字来自“dollars in millions”等口径时,先用脚本换算再写入分析
python .agents/skills/edgartools/scripts/filing_store.py format-value `
  --value "209,586" `
  --source-scale millions `
  --currency USD

# 将多个 status/search/section/facts/table_search 放入一个 UTF-8 JSON 文件;
# PowerShell 不要直接传递内联 JSON,使用文件或通过 stdin 传入
python .agents/skills/edgartools/scripts/filing_store.py batch `
  --request-file ".Codex/tmp/edgar_queries.json"

# 升级 schema、重建 FTS 并清理可确认的脚本残留
python .agents/skills/edgartools/scripts/filing_store.py repair

只有本地证据不足时,才读取更大范围;始终先缩小到 accession、Item/Section、表格行或 XBRL concept/context。长章节保留原始 section,但 FTS5 自动按约 6,000–8,000 字符分块并保留小幅重叠;多关键词搜索使用覆盖全部 token 的最短窗口生成偏移,避免 context 锚定到同一 chunk 中较早出现但无关的单个词。

table-search 先执行行级精确检索;若关键词分散在同一表的不同行,会自动降级为表级 AND 检索。表格的金额单位可能写在相邻正文而不在表头;在中文报告中换算“亿”或英文 billion 前,必须确认 source scale 并调用 format-value,不得心算数量级。

分析能力导航

SkillPurpose
core (this directory)Company lookup, filings, search
financials/Financial statements and metrics
reports/10-K/10-Q/8-K/20-F/40-F/DEF 14A sections
holdings/13F institutional holdings
ownership/Form 3/4/5 insider transactions
funds/Mutual funds, ETFs and BDCs
xbrl/Low-level XBRL facts and concepts
forms.yamlSEC form type mappings

每个专题目录中的 skill.yaml 提供常用模式,sharp-edges.yaml 提供易错点。财务现金流接口统一使用 cash_flow_statement();旧拼写将在 EdgarTools 6.0 删除。

常用入口

from edgar import Company, get_filings, find

company = Company("AAPL")
filing = find("0000320193-25-000079")
filings = get_filings(form="10-K", year=2024)

不确定 API 时使用对象的 .docs 或 .docs.search(),不要猜测方法名。


文档创建时间: 2026-06-16 15:04 最后修改时间: 2026-08-13 18:24

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.