ARCHITECTURE
The Claude Code project model
The intelligence lives in three layers:
-
CLAUDE.md— the master instructions Claude Code loads every session. It defines how to recognize input (screenshot / text / mix) and the exact 6-step workflow: extract → confirm ownership → check availability → evaluate → persist (report + vault sync) → commit. It also documents the owned-portfolio vault (vault/owned/) and the manually-curatedvault/clusters/convention, both separate from the evaluation workflow. -
.claude/skills/domain-eval/SKILL.md— the strategist persona, the 8-dimension scoring framework, the composite-score weights, the verdict tiers, and the JSON output schema. It activates whenever domain evaluation is the task. -
Python helper scripts (
scripts/) — small, deterministic tools Claude Code calls via Bash for the things it genuinely cannot do itself: network lookups and file I/O.
Why we do NOT wrap the Anthropic API
Claude Code is Claude. It already has native vision (reading registrar screenshots) and native reasoning (the strategic evaluation). Wrapping the Anthropic SDK to "analyze the domain" would mean paying for a second Claude to do what the Claude in front of you already does — added latency, added cost, added key management, and a worse result because the wrapped call lacks the conversation context. The scripts therefore contain zero model calls.
Script boundaries
| Script | Responsibility | Why it's code, not Claude |
|---|---|---|
check_availability.py |
RDAP + WHOIS + DNS + HTTP → status JSON | Network I/O is deterministic and outside the model |
save_report.py |
Write report JSON + append history.jsonl | File I/O; must be reproducible and auditable |
lookup_comparables.py |
Match a domain against past reports | Cheap string/fuzzy matching over local data |
estimate_value.py |
Composite score + TLD + SEO data + comparables → asking-price range | A formula re-derived from scratch each session isn't "grounded," it's a differently-worded guess. Same reasoning as lookup_comparables.py: determinism is the point — the same domain gets the same price anchor every session. |
vault.py |
Frontmatter/wikilink/backlink/tag engine; sync-domain writes vault/domains/{domain}.md from a report |
Round-tripping YAML-ish frontmatter and resolving wikilinks is mechanical text processing, not judgment |
import_portfolio.py |
Namecheap + Squarespace CSV exports → vault/owned/*.md + vault/categories/*.md |
CSV merging and regex-rule categorization over ~700 rows is a deterministic batch job, not a per-domain judgment call |
scan_hosting.py |
Concurrent DNS+HTTP sweep of the owned portfolio → hosting status per domain | Same network-I/O rationale as check_availability.py, just batched and without the WHOIS leg (ownership is already known) |
build_site.py |
vault/ + docs/ + project-plans/ → static HTML in site_build/ |
Templating and file aggregation are mechanical; no judgment involved |
Everything else — extraction, scoring, the verdict, the memo, and the build-out plan — is Claude reasoning directly in the conversation.
Ahrefs data stays in the prompt layer
Real SEO data (keyword volume/difficulty, comparable-domain DR) comes from
Claude calling the connected Ahrefs MCP tools directly mid-conversation —
there is no script wrapping this, for the same reason ADR-002 gives for not
wrapping the Anthropic API: Claude Code already has the tool access and the
conversation context; a script that re-fetched and re-summarized the data
would just add latency without adding judgment. The rule that matters
operationally: query Domain Rating for comparable/competitor domains, never
for the target domain itself when it's AVAILABLE or UNKNOWN — an
unregistered or unknown domain has no history to look up.
Availability classification
check_availability.evaluate() is a pure function over four injected helpers
(lookup_rdap, lookup_whois, lookup_dns, lookup_http), which makes it fully
unit-testable offline. Every result carries availability_source
(rdap | whois | dns_http). Decision flow:
- RDAP answered (registry located via IANA's bootstrap file, queried over
HTTPS; WHOIS is skipped) → 404 ⇒
AVAILABLE, unless DNS shows a footprint ⇒UNKNOWN. Registered ⇒ parking nameservers ⇒REGISTERED_PARKED; resolving ⇒REGISTERED_ACTIVE; otherwiseREGISTERED_PARKED. The registry's nameservers stand in when live DNS returns none, and aredemption period/pending deletestatus is called out innotesas a possible drop. - No RDAP service for the TLD, or RDAP failed → fall through to WHOIS.
- WHOIS raised → uncertainty. DNS + HTTP can prove a registration but never
its absence: parking nameservers ⇒
REGISTERED_PARKED; resolving with an HTTP response ⇒REGISTERED_ACTIVE; delegated but no live site ⇒REGISTERED_PARKED; no DNS footprint at all ⇒UNKNOWN. NeverAVAILABLE. - WHOIS has data → parking nameservers ⇒
REGISTERED_PARKED; resolving ⇒REGISTERED_ACTIVE; registered-with-nameservers-but-dormant ⇒REGISTERED_PARKED; registered with neither a parking signal nor any nameservers at all ⇒UNKNOWN(whois data exists but there's no DNS footprint to classify against). - WHOIS empty → no DNS resolution and no nameservers ⇒
AVAILABLE; parking nameservers ⇒REGISTERED_PARKED; resolving ⇒REGISTERED_ACTIVE; nameservers present but not resolving ⇒UNKNOWN.
WHOIS port 43 is frequently blocked (cloud egress, corporate networks), which
is why RDAP over HTTPS goes first: it's the registry's own record and gets
through the same egress that blocks port 43. The DNS+HTTP fallback plus the
uncertainty_flag covers TLDs without RDAP (e.g. .io, .co) when WHOIS is
also blocked, without failing hard or fabricating availability.
Report persistence layer
Reports are plain JSON files in reports/, plus a history.jsonl append log.
This is the audit trail. Because the files live in the repo, every evaluation
Clem has ever run is versioned in git and viewable on GitHub from any device —
no database to host, back up, or query. See DECISIONS.md for the rationale.
history.jsonl also carries asking_price_range_usd and tld per entry
(added alongside estimate_value.py) so lookup_comparables.py can surface
priced comparables, not just verdicts — without that, valuation "grounded in
comparables" would have nothing to blend against.
project-plans/{domain}.md sits next to reports/ but is architecturally
different: reports are immutable point-in-time snapshots (never overwritten,
timestamped filenames), while a project plan is a living document that gets
revised in place as Clem's thinking evolves. Git history is the version log
either way — the difference is just whether a new evaluation produces a new
file or updates an existing one.
The vault
vault/ is a real, committed Obsidian-compatible knowledgebase — every note
is a plain .md file with YAML frontmatter, openable directly in Obsidian or
GitHub, not a database-backed abstraction. scripts/vault.py is the shared
engine every producer and consumer of these notes goes through:
- Frontmatter round-trip (
dump_frontmatter/parse_frontmatter) — a small hand-rolled reader/writer, notpyyaml. It only needs to round-trip the specific shapes this project writes (scalars + flat string lists), and avoiding a compiled/native dependency here is a direct lesson from thenh3CI failure (see DECISIONS.md ADR-010):pyyaml's C extension carries the same wheel-availability risk for no benefit at this scale. - Wikilinks (
Target/Display) resolve by filename-stem alias, case-insensitively, across every note kind at once — an evaluation note, an owned-portfolio note, a theme hub, a category hub, a cluster note, and a build-out plan all share one alias index (build_index), so[go-bankless.ai](../domains/go-bankless.ai.html)resolves the same way no matter which kind of note it's written in. Anything underproject-plans/additionally registers a{stem}-planalias so a plan and its same-named domain note can't collide. - Backlinks (
compute_backlinks) are derived, not stored — every note's "Linked mentions" section is computed fresh at build time from who links to it, the same way Obsidian's own backlinks pane works. - Tags (
collect_tags) come from each note's frontmattertagslist and drive both the dashboard's per-tag pages and theflag/needs-a-lookrenewal-review shortlist.
Two note kinds are generated (never hand-edited, since a re-run overwrites them from source data), two are hand/LLM-authored, and one (clusters) is written only when a real cross-domain opportunity shows up:
| Directory | Kind | Written by | Nature |
|---|---|---|---|
vault/domains/ |
domain |
vault.py sync-domain (from CLAUDE.md Step 5) |
Semi-generated: frontmatter + body sync from the evaluation report on every (re-)evaluation, but content below MANUAL_NOTES_MARKER is preserved |
vault/owned/ |
owned |
import_portfolio.py |
Semi-generated, same manual-notes-preserved pattern, from the Namecheap/Squarespace CSV import |
vault/themes/ |
theme |
vault.rebuild_theme_notes (called by sync-domain) |
Fully generated, fully regenerated every call (stale files deleted first) — one note per unique narrative_hooks value across all evaluations |
vault/categories/ |
category |
import_portfolio.write_category_notes |
Fully generated, fully regenerated every import — one note per import_portfolio.CATEGORY_RULES match |
vault/clusters/ |
cluster |
Claude, in conversation, on request or when it spots a real opportunity | Hand-authored judgment calls only — never mechanically generated for the whole portfolio (see CLAUDE.md) |
Dashboard
build_site.py reads the entire vault (vault/owned/, vault/domains/,
vault/themes/, vault/categories/, and vault/clusters/), the project
docs, and every project-plans/ file, and
renders a static site into site_build/ (gitignored — it's a build
artifact, not source): one page per vault note via a single generic
vault_note.html.jinja template, one page per unique tag, a renewals page
(RENEWAL_WINDOW_DAYS = 60) computed straight from expiration frontmatter,
and a portfolio index. .github/workflows/deploy-pages.yml rebuilds and
redeploys it via GitHub Pages on every push to main. This keeps the "git is
the database" model intact — the dashboard is a read-only view over the same
committed files Clem already has, not a second copy of the data living
somewhere else. reports/*.json remains the untouched, immutable audit-trail
source of truth (ADR-005) — vault/domains/*.md is a synced, richer,
wikilinked view over it, and is what actually renders; the dashboard no
longer renders reports/*.json directly (see DECISIONS.md ADR-011). See
DECISIONS.md for the GitHub Pages private-repo requirement and the
riddle-gate security caveat, and README.md's Dashboard section for the
one-time repo-settings/DNS setup this depends on before it's actually
reachable.
Markdown-sourced content — every vault note's body, plus docs/*.md and
project-plans/*.md — is rendered via markdown.markdown() then
bleach.clean() (pure Python, deliberately not a compiled/native
dependency — see the "no wheel available" build failure this sidestepped)
before being injected with | safe in vault_note.html.jinja /
markdown_page.html.jinja — those templates deliberately bypass Jinja's
autoescaping (autoescaping would just print visible <h1> tags instead
of rendering headings), so the bleach.clean() sanitization step (against an
explicit tag/attribute allowlist, scripts/build_site.py's
_ALLOWED_MARKDOWN_TAGS) is what keeps a malformed or prompt-injected .md
file (vault notes and project-plans/*.md are LLM-written, ultimately
downstream of screenshot/free-text input) from being able to ship a
<script> tag onto the publicly-reachable dashboard.