# mvanhorn/last30days-skill architecture

> Architecture diagram of the GitHub repository mvanhorn/last30days-skill, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mvanhorn/last30days-skill
- Repository: https://github.com/mvanhorn/last30days-skill

## Overview

last30days is an agent-led, multi-source research engine: a topic is planned into searches, source adapters gather recent evidence in parallel, and results are consolidated into a people-engagement-ranked brief. It is exposed as a Python CLI and through an MCP server that embeds and invokes the Python engine. The README documents a broad source catalog; source-family wiring and some later report stages are represented at subsystem level because their implementations were not sampled.

Main entry points: [`skills/last30days/scripts/lib/pipeline.py`](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/pipeline.py) (Search orchestration), [`mcp/internal/tools/preflight.go`](https://github.com/mvanhorn/last30days-skill/blob/main/mcp/internal/tools/preflight.go) (Preflight tool), [`skills/last30days/scripts/last30days.py`](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/last30days.py) (Research CLI), [`mcp/cmd/last30days-pp-mcp/main.go`](https://github.com/mvanhorn/last30days-skill/blob/main/mcp/cmd/last30days-pp-mcp/main.go) (MCP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["Research CLI<br/>[last30days.py]"]
  node_mcpserver["MCP server<br/>[main.go]"]
  node_mcpresearch["Research tool<br/>[research.go]"]
  node_mcppreflight["Preflight tool<br/>[preflight.go]"]
  node_enginecache[("Embedded engine cache<br/>[extract.go]")]
  node_engineinvoke["Python engine runner<br/>[run.go]"]
end

subgraph group_orchestration["Research orchestration"]
  node_planner["Query planning<br/>[planner.py]"]
  node_query["Query shaping<br/>[query.py]"]
  node_pipeline["Search orchestration<br/>[pipeline.py]"]
end

subgraph group_sources["Evidence sources"]
  node_sourceadapters["Platform adapters"]
  node_websearch["Keyless web search"]
end

subgraph group_results["Analysis and reports"]
  node_rankcluster["Rank and cluster<br/>[pipeline.py]"]
  node_report["Brief rendering<br/>[render.py]"]
  node_htmlreport["HTML brief<br/>[html_render.py]"]
end

subgraph group_operations["Preflight and state"]
  node_memory[("Research memory<br/>[store.py]")]
  node_preflight["Safe preflight<br/>[preflight.py]"]
end

node_researcher(("Researcher / agent"))
node_mcpclient(("MCP client"))
node_platforms(("Social, news, research platforms"))

node_researcher -->|"submits topic"| node_cli
node_cli -->|"runs research"| node_pipeline
node_pipeline -->|"plans queries"| node_planner
node_pipeline -->|"shapes searches"| node_query
node_pipeline -->|"dispatches searches"| node_sourceadapters
node_sourceadapters -->|"fetches evidence"| node_platforms
node_pipeline -.->|"requests web results"| node_websearch
node_websearch -->|"searches web"| node_platforms
node_pipeline -->|"ranks and clusters"| node_rankcluster
node_rankcluster -->|"provides findings"| node_report
node_report -->|"returns brief"| node_cli
node_report -.->|"renders HTML"| node_htmlreport
node_cli -.->|"persists findings"| node_memory
node_mcpclient -->|"calls tools"| node_mcpserver
node_mcpserver -->|"registers research"| node_mcpresearch
node_mcpserver -->|"registers preflight"| node_mcppreflight
node_mcpresearch -->|"extracts engine"| node_enginecache
node_mcppreflight -->|"extracts engine"| node_enginecache
node_mcpresearch -->|"invokes engine"| node_engineinvoke
node_mcppreflight -->|"invokes preflight"| node_engineinvoke
node_engineinvoke -->|"runs Python CLI"| node_pipeline
node_mcppreflight -->|"requests diagnostics"| node_preflight
node_researcher -->|"requests research"| node_mcpclient

click node_cli "https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/last30days.py"
click node_mcpserver "https://github.com/mvanhorn/last30days-skill/blob/main/mcp/cmd/last30days-pp-mcp/main.go"
click node_mcpresearch "https://github.com/mvanhorn/last30days-skill/blob/main/mcp/internal/tools/research.go"
click node_mcppreflight "https://github.com/mvanhorn/last30days-skill/blob/main/mcp/internal/tools/preflight.go"
click node_enginecache "https://github.com/mvanhorn/last30days-skill/blob/main/mcp/internal/engine/extract.go"
click node_engineinvoke "https://github.com/mvanhorn/last30days-skill/blob/main/mcp/internal/engine/run.go"
click node_planner "https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/planner.py"
click node_query "https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/query.py"
click node_pipeline "https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/pipeline.py"
click node_sourceadapters "https://github.com/mvanhorn/last30days-skill/tree/main/skills/last30days/scripts/lib"
click node_websearch "https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/web_search_keyless.py"
click node_rankcluster "https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/pipeline.py"
click node_report "https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/render.py"
click node_htmlreport "https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/html_render.py"
click node_memory "https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/store.py"
click node_preflight "https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/preflight.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_mcpserver,node_mcpresearch,node_mcppreflight,node_enginecache,node_engineinvoke,node_mcpclient toneBlue
class node_planner,node_query,node_pipeline toneAmber
class node_sourceadapters,node_websearch toneMint
class node_rankcluster,node_report,node_htmlreport toneRose
class node_memory,node_preflight,node_researcher,node_platforms toneIndigo
```

## Components

### User interfaces

- [Research CLI](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/last30days.py): `skills/last30days/scripts/last30days.py`
- [MCP server](https://github.com/mvanhorn/last30days-skill/blob/main/mcp/cmd/last30days-pp-mcp/main.go): `mcp/cmd/last30days-pp-mcp/main.go`
- [Research tool](https://github.com/mvanhorn/last30days-skill/blob/main/mcp/internal/tools/research.go): `mcp/internal/tools/research.go`
- [Preflight tool](https://github.com/mvanhorn/last30days-skill/blob/main/mcp/internal/tools/preflight.go): `mcp/internal/tools/preflight.go`
- [Embedded engine cache](https://github.com/mvanhorn/last30days-skill/blob/main/mcp/internal/engine/extract.go): `mcp/internal/engine/extract.go`
- [Python engine runner](https://github.com/mvanhorn/last30days-skill/blob/main/mcp/internal/engine/run.go): `mcp/internal/engine/run.go`

### Research orchestration

- [Query planning](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/planner.py): `skills/last30days/scripts/lib/planner.py`
- [Query shaping](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/query.py): `skills/last30days/scripts/lib/query.py`
- [Search orchestration](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/pipeline.py): `skills/last30days/scripts/lib/pipeline.py`

### Evidence sources

- [Platform adapters](https://github.com/mvanhorn/last30days-skill/tree/main/skills/last30days/scripts/lib): `skills/last30days/scripts/lib`
- [Keyless web search](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/web_search_keyless.py): `skills/last30days/scripts/lib/web_search_keyless.py`

### Analysis and reports

- [Rank and cluster](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/pipeline.py): `skills/last30days/scripts/lib/pipeline.py`
- [Brief rendering](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/render.py): `skills/last30days/scripts/lib/render.py`
- [HTML brief](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/html_render.py): `skills/last30days/scripts/lib/html_render.py`

### Preflight and state

- [Research memory](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/store.py): `skills/last30days/scripts/store.py`
- [Safe preflight](https://github.com/mvanhorn/last30days-skill/blob/main/skills/last30days/scripts/lib/preflight.py): `skills/last30days/scripts/lib/preflight.py`

### Other components

- **Researcher / agent**
- **MCP client**
- **Social, news, research platforms**

## Connections

- Researcher / agent → Research CLI: submits topic
- Research CLI → Search orchestration: runs research
- Search orchestration → Query planning: plans queries
- Search orchestration → Query shaping: shapes searches
- Search orchestration → Platform adapters: dispatches searches
- Platform adapters → Social, news, research platforms: fetches evidence
- Search orchestration → Keyless web search: requests web results
- Keyless web search → Social, news, research platforms: searches web
- Search orchestration → Rank and cluster: ranks and clusters
- Rank and cluster → Brief rendering: provides findings
- Brief rendering → Research CLI: returns brief
- Brief rendering → HTML brief: renders HTML
- Research CLI → Research memory: persists findings
- MCP client → MCP server: calls tools
- MCP server → Research tool: registers research
- MCP server → Preflight tool: registers preflight
- Research tool → Embedded engine cache: extracts engine
- Preflight tool → Embedded engine cache: extracts engine
- Research tool → Python engine runner: invokes engine
- Preflight tool → Python engine runner: invokes preflight
- Python engine runner → Search orchestration: runs Python CLI
- Preflight tool → Safe preflight: requests diagnostics
- Researcher / agent → MCP client: requests research
