4 Commits
Author SHA1 Message Date
GandClaude Opus 5 c1948d1274 chore: add a formatter (#34)
* chore: add a formatter, matching the style this repo already writes

singleQuote=false was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* style: format with prettier (13 files)

Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* chore: teach git blame to skip the reformat

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 08:14:25 +00:00
GandClaude Opus 5 d8e80554aa fix(cli): ask the chain which vendors count, not one key by name (#18)
#16 replaced a pinned model with a walked chain and gave this app a second
vendor: `usableChain` drops any provider whose key is absent, so an environment
holding only OPENROUTER_API_KEY is a complete, working configuration — five
usable links — and the HTTP route serves it happily.

`scripts/analyze-cli.ts` never got the message. Its preflight still read

    if (!process.env.GROQ_API_KEY) exit(1)

so that same environment was turned away at the door, by an error naming a key
it does not need. This is the only way to use truthseeker today — there is no
deployment — so the migration's one unmigrated call site was also its most
load-bearing one.

The defect is not the missing key name; it is that the CLI answered a question
lib/llm already answers. `configuredLinks(env)` and `noProviderMessage()` are
now exported and the script asks them. Both derive from the chain: the message
lists `keyEnv` for every provider in it rather than a sentence someone typed, so
a hand-written key list cannot go stale the way a hand-written model id did.

The preflight itself stays — an article fetch is ~20s that cannot produce
anything without a vendor behind it — it just no longer has its own opinion
about what counts.

Three more places carried the same untruth and now don't:

  README      "GROQ_API_KEY … required", and a Stack line still advertising
              `llama-3.3-70b-versatile` — the exact id Groq retired, which is
              what #16 was written to survive.
  .env.example  "Single env var; if/when we swap … change src/lib/llm.ts".
  .gitignore  and that file reached nobody anyway: Next.js's default `.env*`
              swallowed it, so the template explaining which keys this app
              needs has never been in a clone. Now negated and tracked.

Tests: 5 added. Four drive the preflight; the fifth gates the seam the way
claim-types.test.ts gates its own SSOT — it reads analyze-cli.ts and fails if
that file names any *_API_KEY itself. Both of its assertions fail against the
pre-fix script, verified by running them against `git show HEAD:` output.

Verified: npm run verify (lint, tsc, 42 tests) and next build clean; the CLI run
end to end with no keys (exits 1 naming both) and with OPENROUTER_API_KEY alone
(passes the preflight and proceeds — the case that used to exit 1).

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-27 06:12:39 +02:00
Mao NakamotoandClaude Sonnet 5 69461ed753 fix: report truncated, not raw, char count after analysis
fetched.textLength reported the full pasted/fetched length even when
the 20k-char cap (21d025e) cut the text before it reached the model —
so the UI and CLI silently claimed to have "examined" more than was
actually analyzed. Now textLength reflects what was sent to the LLM,
and a truncated flag surfaces a visible note in both the web UI and
CLI output.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 04:07:00 +00:00
Mao Nakamoto e2f584440d feat: initial truthseeker scaffold + first-principles analyzer
First-principles rebuttal generator. Given a URL (or pre-fetched
article text via --text), produces a structured JSON analysis:

- title, author, publication, publication_date, language
- 2-3 sentence neutral summary
- 3-5 core claims with type (factual/normative/causal) and
  evidence_quality flag
- 250-500 word first-principles critique (engages with the strongest
  version of the article's argument, separates claim types, refuses
  the tribal frame)
- named sources with role + attributed claim
- biases to consider (specific, not generic political-axis labels)
- what would change the assessment

## Stack
- Next.js 16 + React 19 + Tailwind v4
- Groq llama-3.3-70b-versatile via src/lib/llm.ts (single swap point
  for the LLM provider)
- No third-party deps for the article fetch — vanilla regex + entity
  decode in src/lib/article-fetch.ts, no jsdom/Readability overhead
- tsx-powered CLI at scripts/analyze-cli.ts: writes
  analyses/<slug>.md so output is reviewable + committable

## Modes
1. URL mode: `npm run analyze -- "https://..."`. Direct fetch with
   real browser-shaped headers. Works for most public sites.
2. Pre-fetched text mode: `npm run analyze -- "https://..." --text
   path/to/body.txt`. Escape hatch for bot-gated sources (Republik,
   most major paywalled outlets) — fetch in a logged-in browser, save
   to a file, pass the path in. URL still rides along for attribution.

## Why this project exists
Articles in the wild bundle factual, normative, and causal claims
under one rhetorical posture. The job of a careful reader is to
separate them, then engage with the load-bearing parts. truthseeker
does that mechanically so the reader's attention stays on the
substance.

## Architecture (SoC)
- src/lib/article-fetch.ts — HTTP + HTML → plain text (pure function)
- src/lib/llm.ts — Groq client (the only paid edge)
- src/lib/prompts.ts — system prompt + user-prompt builder (the
  load-bearing piece; iterate independently of plumbing)
- src/lib/analysis.ts — orchestrator: analyzeUrl + analyzeText
- src/app/api/analyze/route.ts — thin POST wrapper around analysis.ts
- src/app/page.tsx — URL input + result render (client-side)
- scripts/analyze-cli.ts — no-server CLI that calls the same analysis lib

Built as the first dogfood project on top of FleetCrown's bootstrap
loop. See https://fleetcrown.vercel.app/thoughts/from-idea-to-first-commit-the-fleetcrown-bootstrap-loop
for the loop's design context.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-06-05 15:48:43 +02:00