Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
4198606
feat(r1): 売買判断を前提にした既定の 3 面を外す(write-memo / flush / memory_search 指示)
rikukoike Sep 22, 2026
cd5d64f
feat(guard): 入力ガード(語彙 + 構造の 2 層)と出力 linter(当社生成だけを走査)
rikukoike Sep 22, 2026
1023659
test(guard): 固定評価集合 held-out #3 で 2 層の実力を測る(決定論 18/30・Noul 29/30・OR 3…
rikukoike Sep 22, 2026
0d20de4
fix(permissions): 秘密パスの deny を bash 以外の全ツールに掛け、`.dexter/checks/` を加える
rikukoike Sep 22, 2026
dfc241d
feat(commands): 引数つきスラッシュコマンドを解析できるようにする(`/check 7203 <仮説>`)
rikukoike Sep 22, 2026
36a203c
feat(config): 送信先を単一の台帳にし、README の表と起動画面をそこから作る(G-D2)
rikukoike Sep 22, 2026
ee055da
feat: 判定層 / 主張の分解・数値検算 / `/watch` + `/v1/events` クライアントを統合(T1・T2・T4)
rikukoike Sep 22, 2026
4286153
feat(check): 判定層が LLM 代行のときは `/check` を走らせない(小池裁定 B)
rikukoike Sep 22, 2026
0c9073c
feat(install): `DEXTER_SKIP_BROWSER=1` で Chromium を落とさない + 不在時の案内
rikukoike Sep 22, 2026
83797b3
feat(check): `/check` のパネル組み立て(判定不能・逐語と当社生成の分離・deep link)
rikukoike Sep 22, 2026
fcc05e1
feat(check): `/check` の組み立て(ガード → 分解 → 段落化 → 判定 → 検算 → パネル → 記録)
rikukoike Sep 22, 2026
481eb10
feat(cli): `/check` を配線し、引数つきコマンドが黙って無視される穴を塞ぐ
rikukoike Sep 22, 2026
0ca1cd3
fix(check): EDINET DB の実応答に合わせて取得層を直す(推測で書いていた 3 点)
rikukoike Sep 22, 2026
3f27b8e
fix(check): `/v1/events` の日付窓と出典の取り違えを直す + README に「答え合わせ」の節
rikukoike Sep 23, 2026
d618241
feat(demo): `bun run demo` = 録画した `/check` の再生(鍵なし・外部通信ゼロ)
rikukoike Sep 23, 2026
de95fdc
docs: RELEASE-NOTES v1.1.0-jp + env.example / AGENTS.md の陳腐化修正 + LICE…
rikukoike Sep 23, 2026
4a5a35c
docs(en): README.en.md に Answer-checking の節(送信先の表は台帳から生成)
rikukoike Sep 23, 2026
15d0fcb
fix(check): T9 H2/H3/H5/H6 — 範囲の補い・禁止語での例外・replay の鍵迂回・CLI の例外
rikukoike Sep 23, 2026
18edc6a
fix: T9 H1/H4/M3/M4/M8/M9 — 起動時の送信先表示・README の約束を実装に合わせる・scratch 削除
rikukoike Sep 23, 2026
9cd0a08
fix(check): 本番の取得層が常に段落 0(二重包み)+ T9 M1/M2/M5
rikukoike Sep 23, 2026
d2914e7
chore: version 1.1.0-jp
rikukoike Sep 23, 2026
3881c25
fix(check): パネルの証券コードを 4 桁で出す(EDINET DB の 5 桁 72030 → 7203)
rikukoike Sep 23, 2026
edf8810
fix: Codex T9 H1-H4 / M2 / L1 — @.env 迂回・選択モデル・否定形の表示・送信先の鍵名・quote の実在確認
rikukoike Sep 23, 2026
35b1fe8
docs+test: README の必須記載(go-decision §9.2)を文言どおり置き、grep テストで固定
rikukoike Sep 23, 2026
f11aa42
docs(release-notes): 起動時の送信先一覧を「変わる挙動」に
rikukoike Sep 23, 2026
c3cf087
docs: 全文で回すと判定が割れることがある件を README(日英)・RELEASE-NOTES に。例は録画(選んだ 10 段落)だと明記
rikukoike Sep 23, 2026
8dc6059
fix(check): Agent SDK モードでは /check を通信前に止める(Codex T9 r2 H1)
rikukoike Sep 23, 2026
4804b15
fix(check): 判定の問いに対象会社・対象期間、証拠に FY を入れる(Codex T9 r2 H2)+ T6 を同じ形で測り直し…
rikukoike Sep 23, 2026
2957282
docs: RELEASE-NOTES を「新機能 /check と Jev 連携 → 既知の限界」の構成に。起動時の送信先一覧の説明を実…
rikukoike Sep 23, 2026
48e7544
fix(demo): 録画の判定を公開版と同じ問いの形(対象会社・対象期間入り)で取り直す
rikukoike Sep 23, 2026
b043d3c
fix(demo): 録画に「実際に投げた問い」のハッシュを持たせ、再生時に照合(Codex T9 r3 M1)+ demo テストを取り…
rikukoike Sep 23, 2026
bd79e46
docs(readme): 起動時の送信先一覧の括弧書きを、埋め込み先の自動選択と矛盾しない形に(Codex T9 r4 L1)
rikukoike Sep 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 34 additions & 6 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,37 @@

- Source code: `src/`
- Agent core: `src/agent/` (agent loop, prompts, scratchpad, token counting, types)
- CLI interface: `src/cli.tsx` (Ink/React), entry point: `src/index.tsx`
- CLI interface: `src/cli.ts` (Ink/React), entry point: `src/index.tsx`
- Components: `src/components/` (Ink UI components)
- Hooks: `src/hooks/` (React hooks for agent runner, model selection, input history)
- Model/LLM: `src/model/llm.ts` (multi-provider LLM abstraction)
- Tools: `src/tools/` (financial search, web search, browser, skill tool)
- Finance tools: `src/tools/finance/` (financials, text-blocks, earnings, shareholders, key-ratios, screening)
- Search tools: `src/tools/search/` (Exa preferred, Tavily fallback)
- Browser: `src/tools/browser/` (Playwright-based web scraping)
- Skills: `src/skills/` (SKILL.md-based extensible workflows, e.g. DCF valuation)
- Utils: `src/utils/` (env, config, caching, token estimation, markdown tables)
- Evals: `src/evals/` (LangSmith evaluation runner with Ink UI)
- Evals: `src/evals/` (LangSmith evaluation runner with Ink UI), `src/evals/judge/` (judge-layer benchmark)
- Judge layer: `src/judge/` (typed questions answered with probabilities; `jev` / `llm` / `replay` backends)
- `/check`: `src/check/` (assembly, panel, record) and `src/check/core/` (pure claim/paragraph/numeric helpers)
- `/watch`: `src/watch/` (+ `src/tools/finance/events.ts` for the disclosure feed)
- Guards: `src/guard/` (input guard, output linter) — see "Guards" below
- Egress ledger: `src/config/egress.ts` (single source for the README table and the startup screen)
- Bundled disclosure data: `src/data/` (schema + build gate) and `src/data/materials/`
- Deep links: `src/links/deeplink.ts` (URL construction only)
- Config: `.dexter/settings.json` (persisted model/provider selection)
- Environment: `.env` (API keys; see `env.example`)

## Build, Test, and Development Commands

- Runtime: Bun (primary). Use `bun` for all commands.
- Install deps: `bun install`
- Install deps: `DEXTER_SKIP_BROWSER=1 bun install` (skips the ~130MB Chromium download; drop the flag when you need the `browser` tool)
- Run: `bun run start` or `bun run src/index.tsx`
- Dev (watch mode): `bun run dev`
- Type-check: `bun run typecheck`
- Tests: `bun test`
- Demo (no keys, no network): `bun run demo`
- Bundled-data gate: `bun run check:data`
- Judge benchmark: `bun run bench:judge`
- Evals: `bun run src/evals/run.ts` (full) or `bun run src/evals/run.ts --sample 10` (sampled)

## Coding Style & Conventions
Expand All @@ -43,7 +52,7 @@
## LLM Providers

- Supported: OpenAI (default), Anthropic, Google, xAI (Grok), OpenRouter, Ollama (local).
- Default model: `gpt-5.5`. Provider detection is prefix-based (`claude-` -> Anthropic, `gemini-` -> Google, etc.).
- Default model: `gpt-5.6-sol` (`DEFAULT_MODEL` in `src/model/llm.ts`). Provider detection is prefix-based (`claude-` -> Anthropic, `gemini-` -> Google, etc.).
- Fast models for lightweight tasks: see `FAST_MODELS` map in `src/model/llm.ts`.
- Users switch providers/models via `/model` command in the CLI.

Expand All @@ -57,6 +66,19 @@
- `skill`: invokes SKILL.md-defined workflows (e.g. DCF valuation).
- Tool registry: `src/tools/registry.ts`. Tools are conditionally included based on env vars.

## Guards (v1.1.0-jp)

- `/check` refuses to run unless the judge layer is `jev` or `replay` (`src/check/preflight.ts`).
Measured on a held-out set never used for tuning: the deterministic layer alone lets 12/30
advice-seeking inputs through, the judge vote alone 1/30, both together 0/30 — and the LLM
stand-in as the vote lets 8/30 through. Shipping that would contradict the README.
- Input guard = deterministic vocabulary + structural intent patterns, OR the judge's vote.
A judge vote can never *lift* a deterministic refusal.
- Output linter scans **only strings we generated**. Verbatim disclosure text is carried as
`{kind:'quote'}` and never scanned — annual reports legitimately contain 割高 / 下値 / 配分.
- Secret paths (`.env`, `.dexter/credentials/`, `.dexter/checks/`) are denied for every tool that
takes a path argument, not just `bash`.

## Financial Data Source

- **EDINET DB API** (edinetdb.jp): Structured financial data from ~3,800 Japanese listed companies
Expand All @@ -67,14 +89,20 @@
## Skills

- Skills live as `SKILL.md` files with YAML frontmatter (`name`, `description`) and markdown body (instructions).
- Built-in skills: `src/skills/dcf/SKILL.md` (adapted for Japanese market: JGB rates, JPY, TSE PBR context).
- Built-in skills: `src/skills/dcf/SKILL.md` (adapted for Japanese market: JGB rates, JPY, TSE PBR context)
and `src/skills/x-research/`.
- `src/skills/write-memo/` was **removed in v1.1.0-jp**: its description offered a long/short equity
recommendation memo, which contradicts what `/check` and `/watch` state they do not output.
`src/guard/no-advice-surface.test.ts` fails if it comes back.
- Discovery: `src/skills/registry.ts` scans for SKILL.md files at startup.

## Environment Variables

- LLM keys: `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `GOOGLE_API_KEY`, `XAI_API_KEY`, `OPENROUTER_API_KEY`
- Ollama: `OLLAMA_BASE_URL` (default `http://127.0.0.1:11434`)
- Finance: `EDINETDB_API_KEY`
- Judge layer: `TYPESAFE_API_KEY` — **`/check` does not run without it** (see "Guards")
- Install: `DEXTER_SKIP_BROWSER` (the judge replay is injected by `bun run demo` and tests as a port, never read from env)
- Search: `EXASEARCH_API_KEY` (preferred), `TAVILY_API_KEY` (fallback)
- Tracing: `LANGSMITH_API_KEY`, `LANGSMITH_ENDPOINT`, `LANGSMITH_PROJECT`, `LANGSMITH_TRACING`
- Never commit `.env` files or real API keys.
Expand Down
50 changes: 50 additions & 0 deletions LICENSE-DATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# LICENSE-DATA

このファイルは、このリポジトリの `src/data/materials/` に同梱される抜粋データ
(有価証券報告書の逐語段落。EDINET 由来)に適用されるライセンスです。

**リポジトリ本体のソースコードには `LICENSE`(MIT)が適用されます。
`src/data/materials/` 配下のデータは MIT の対象ではありません。** 金融庁
EDINET および各提出会社の著作物を含むため、以下の条件の下でのみ利用できます。

## 1. 出典

`src/data/materials/` 配下の各ファイルは、EDINET(金融庁)で公開されている
有価証券報告書からの抜粋です。EDINET の「公共データ利用規約(第1.0版)」
(PDL1.0、https://www.digital.go.jp/resources/open_data/public_data_license_v1.0)
に基づいて利用しています。

各素材ファイルは `citation` フィールドに、EDINET 利用規約が定める出典記載例
の書式で出典を記載しています:

出典:EDINET閲覧(提出)サイト(当該ページのURL)、PDL1.0(規約原文ページのURL)

また、各ファイルには編集・加工の主体として `"editor": "Cabocia"` を記載して
います(EDINET 利用規約: 「本コンテンツを編集・加工等して利用する場合は、上記
出典とは別に、編集・加工等を行ったこと及びその主体を記載してください」)。

## 2. 第三者の権利

PDL1.0 は「第三者が著作権その他の権利を有しているものがあります…明確に
第三者が権利を有している部分の特定・明示等を行っていないものもあります」と
注意しています。有価証券報告書の本文についても、提出会社が著作権その他の
権利を有する可能性があります。本データを再利用する場合は、この点を踏まえて
ご自身の責任で判断してください。

## 3. 許可すること・許可しないこと

- 許可: このリポジトリの一部として、`citation` フィールドと `editor`
フィールドの記載を保持したまま複製・再配布すること
- 許可しない: `citation` フィールドや編集・加工の主体の記載を外しての再配布
- 許可しない: このデータを、単独の(このリポジトリの demo・検証目的の同梱を
超える)データセットとして切り出して配布・商用利用すること

## 4. 削除・差し替えの要請

対象文書の提出者から該当段落の削除・差し替えの要請があった場合、Cabocia は
該当ファイルを速やかに削除・差し替えます。連絡先は README を参照してください。

## 5. 免責

本データは EDINET の公開情報をそのまま抜粋したものであり、Cabocia が内容の
正確性・完全性を保証するものではありません。
101 changes: 101 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,107 @@ This project is for **educational, entertainment, and informational purposes onl

By using this software, you agree to use it solely for learning and informational purposes and accept all risks associated with its use.

## Answer-checking (v1.1.0-jp)

Bring your own hypothesis about a company. Dexter JP puts it against the paragraphs of that company's annual securities report (有価証券報告書), one claim at a time, and tells you which paragraphs support it, which contradict it, and which are about something else — with the source for each. It shows you what the company itself wrote. It does not tell you what to do about it.

```
/check 9983 中国事業は回復していると会社は説明している
```

Your hypothesis is split into claims (shown next to your original wording), the relevant sections of the annual report are cut into paragraphs, and each paragraph is checked against each claim. If the paragraphs cannot settle a claim, you get "判定不能" (cannot determine) — the model is not asked to fill the gap.

The panel shows your original wording, the claims it was split into, the company's own paragraphs behind each verdict (with document ID, filer, document type and section), and how much of the report was examined.

### Run it first

```bash
DEXTER_SKIP_BROWSER=1 bun install
bun run demo
```

`bun run demo` replays a recorded run. No API keys, no network calls. The screen says so.

`DEXTER_SKIP_BROWSER=1` skips the Chromium download (130MB+). Install without it when you want the `browser` tool.

### What you need to run your own hypotheses

| | Keys | What works |
|---|---|---|
| 1 | none | `bun run demo` (replay of a recording) |
| 2 | `EDINETDB_API_KEY` + `TYPESAFE_API_KEY` | `/check` |

An EDINET DB key is [free](https://edinetdb.jp/developers?utm_source=github&utm_medium=readme&utm_campaign=dexter-kotaeawase) (account required).

**`/check` does not run without `TYPESAFE_API_KEY`.** We did not make it fall back to a local LLM labelling things instead. Here is why.

The entrance to `/check` screens out inputs asking for trading advice or for a view on price level. That screen is two things: a deterministic check on vocabulary and phrasing, and a vote from the judge layer. Neither is enough alone. Measured on 30 advice-seeking inputs written by a separate model that was shown neither the implementation nor the word list:

| Screen | Got through | False positives on 20 ordinary inputs |
|---|---|---|
| Deterministic vocabulary and phrasing only | 12/30 | 0/20 |
| Judge layer (Jev) vote only | 1/30 | 0/20 |
| Both together (what ships) | 0/30 | 0/20 |
| Deterministic + a local LLM as the vote | 8/30 | 0/20 |

A local LLM standing in for the judge lets 8 of 30 through. We would rather stop than run with that gap. Use `bun run demo` to see the output before you add a key.

### What it does not output

- Dexter JP does not provide investment advice. `/check` and `/watch` do not output trade instructions, price targets, or position sizes
- No view on whether a stock is cheap or expensive, and no fair value. Inputs asking for those do not reach the judgment step; you get two or three suggested rewordings that the disclosures can actually answer
- No market-regime labels (uptrend, near highs, and so on)
- Counts are reported as "how many of the examined paragraphs fell into each bucket". They are never rolled up into a single "support score"
- The probability shown is the model's estimate of the relationship between that paragraph and that claim. It is not the probability that your hypothesis is true
- `/check` records stay on your machine in `.dexter/checks/`. Delete that directory to delete them

### Where your data goes

This table is a translation. The canonical list is the Japanese table in `README.md`, which a test keeps identical to the ledger in `src/config/egress.ts`.

| Destination | What is sent | When | Default |
|---|---|---|---|
| EDINET DB | Ticker codes and API requests (annual report text, financials, disclosure events) | `EDINETDB_API_KEY` | on |
| Your selected LLM provider | Your hypothesis, annual report paragraphs, conversation (decomposition, summarisation, free-form questions) | The key for the provider you chose (`/model`) | on |
| TypeSafe (Jev, US) | The claims split out of your hypothesis, and annual report paragraphs, one at a time | `TYPESAFE_API_KEY` | off |
| Conversation-history embedding (OpenAI → Gemini → Ollama, auto-selected) | Full conversation text. Chosen **independently of your selected LLM** — with `OPENAI_API_KEY` set it goes to OpenAI even if `/model` is Claude | On by default; any of `OPENAI_API_KEY` / `GOOGLE_API_KEY` / `OLLAMA_BASE_URL` | on |
| LangSmith | LangChain prompts and tool results (traces) | `LANGSMITH_TRACING=1` | off |
| J-Quants | Ticker codes and dates (stock prices) | `JQUANTS_API_KEY` | off |
| Web search provider (Tavily / Exa / Perplexity / LangSearch) | Search terms (only to the provider you chose with `/search`) | The key for the provider you chose | off |
| X (Twitter) | Search terms you typed, or that the agent composed | `X_BEARER_TOKEN` | off |
| Ollama (local by default; remote if configured) | Conversation text and text to embed | `OLLAMA_BASE_URL` / `OLLAMA_CLOUD_API_KEY` | off |
| OpenRouter | Conversation text (when an OpenRouter model is selected) | `OPENROUTER_API_KEY` | off |
| Moonshot | Conversation text (when Kimi is selected) | `MOONSHOT_API_KEY` | off |
| DeepSeek | Conversation text (when a DeepSeek model is selected) | `DEEPSEEK_API_KEY` | off |
| Messaging gateways (Slack / Discord / WhatsApp / LINE) | Agent replies (only if you start a gateway) | When you start that gateway | off |

We do not write that TypeSafe (Jev) "does not store" your data. Their terms say inputs are not used as training data, while reserving the right to process them for telemetry, abuse prevention and legal compliance. Read each service's terms yourself.

Conversation-history embedding is on by default, and **its destination is chosen independently of the model you selected**. If `OPENAI_API_KEY` is in your `.env`, your conversation goes to OpenAI even when `/model` is set to Claude. On startup, Dexter JP prints the destinations your `.env` keys make possible for that session (listing a destination does not mean data is actually sent; conditions vary by feature, and the embedding destination is selected automatically).

### Bundled data

The paragraphs replayed by `bun run demo` are annual report text, identical to the bundled data in `src/data/materials/` (a test checks this). Each entry there carries a document ID, filer, document type, section, retrieval date, the required attribution, and the party that edited it.

> 出典:EDINET閲覧(提出)サイト(https://disclosure2.edinet-fsa.go.jp/)、PDL1.0(https://www.digital.go.jp/resources/open_data/public_data_license_v1.0)

This data is **not covered by the MIT licence**. Its terms are in `LICENSE-DATA`, along with the procedure for a filer to request a change or removal.

### Before you use it

If you use the output of this tool to provide information to third parties (a public bot, for example), you may yourself fall under the Financial Instruments and Exchange Act or other regulations.

### Not in this release

- TradingView connection. Reading your watchlist is deferred to a later release
- `/check` under Agent SDK mode. We have not verified that decomposition and summarisation run through a single SDK `query()`, so it is unsupported here
- `/watch` as a command. The data layer is implemented; wiring it up as a command comes next
- Checking numeric claims against financial data. The parts exist but are not wired into `/check` yet, so `/check` in this release only checks text claims against paragraphs

### When verdicts split

Run against the full annual report, the judge can read a paragraph about a segment's or a region's profit increase as contradicting a consolidated profit decline, so claims can come back split. On Toyota's 122nd-period annual report (103 paragraphs across MD&A, business risks and management policy), the hypothesis "the company explains that the fall in operating profit was mainly due to exchange rates" came back split on all three claims (the decline: 12 supporting / 3 contradicting). The `bun run demo` recording uses 10 paragraphs selected from the same report.

## Not Just Another Financial Tool

Most financial tools stop at "here's a screener" or "here's the data." Dexter JP goes further.
Expand Down
Loading
Loading