How dineshkrishna9999/firsttoknow works
Purpose and Entry Points
FirstToKnow is a Python 3.11+ terminal application that tracks a developer’s dependencies, repositories, and topics; produces LLM-prioritized tech briefings; and guards new dependencies before git pushes. The executable entry path is src/firsttoknow/__main__.py, delegating command handling to the Typer CLI in src/firsttoknow/cli.py.
CLI Orchestration and Persistent State
The CLI exposes tracking, scanning, briefing, guard, hook-installation, and configuration commands. It is the main boundary between user input and internal workflows. User-selected model settings and tracked items are persisted under the user’s ~/.firsttoknow/ area through src/firsttoknow/config.py; shared domain records and report/severity types live in src/firsttoknow/models.py.
Paths: src/firsttoknow/cli.py, src/firsttoknow/config.py, src/firsttoknow/models.py.
Dependency Discovery and Tracking
scan discovers dependencies from supported project manifests, while explicit track commands add PyPI, npm, GitHub, or topic targets. Scanner output becomes tracked-item state, rather than directly invoking briefing services. This keeps local project inspection separate from remote intelligence gathering.
Paths: src/firsttoknow/scanner.py, src/firsttoknow/cli.py, src/firsttoknow/models.py.
Agent-Driven Briefing Pipeline
brief loads tracked state and runs an ADK-based agent. The agent receives briefing instructions and dynamically selects information-gathering tools; the application does not hardcode a fixed fetch sequence. LiteLLM provides model-provider abstraction, allowing OpenAI, Azure OpenAI, Gemini, Anthropic, or local Ollama models. The resulting synthesis is prioritized into critical, important, and FYI content.
Paths: src/firsttoknow/agents/agent.py, src/firsttoknow/agents/instructions/briefing.py, src/firsttoknow/agents/_tools.py.
External Intelligence and Security Boundary
Agent tools make live calls to PyPI, npm, GitHub, Hacker News, Dev.to, Reddit, and OSV.dev. OSV is the vulnerability authority for CVE lookup; package registries and social/code platforms supply release, repository, and discussion context. Tool implementations are centralized, making remote API behavior a clear boundary from agent reasoning.
Paths: src/firsttoknow/agents/_tools.py, src/firsttoknow/agents/agent.py.
Guard and Git Hook Workflow
The guard examines git diffs for newly introduced dependencies, then evaluates OSV vulnerabilities, license changes, and probable typosquats. An optional LLM review extends this flow to source diffs. Hook support installs/invokes the guard as a pre-push control point, so a risky dependency can be identified before code leaves the local repository.
Paths: src/firsttoknow/guard.py, src/firsttoknow/hooks.py, src/firsttoknow/typosquat.py.
Presentation Runtime
Rich terminal rendering handles progress feedback, formatted Markdown briefings, hyperlinks, status views, and guard-grade reports. It is downstream of both agent and guard workflows and should not own business decisions.
Paths: src/firsttoknow/renderer.py, src/firsttoknow/cli.py.
Runtime and Delivery
The runtime is packaged as a typed Python project under src/firsttoknow/, with dependencies and task definitions in pyproject.toml and poe.toml. Development is container-capable via .devcontainer/, while CI is defined in .github/workflows/ci.yml.
Main entry points: cli.py Typer CLI · agent.py ADK briefing agent · guard.py Dependency guard · _tools.py Intelligence tools
Components 16
CLI & State
User-facing commands and persistent tracking state.
- Python entry point
src/firsttoknow/__main__.py - Typer CLI
src/firsttoknow/cli.py - User config & tracked state · Stores settings and tracked items under ~/.firsttoknow/.
src/firsttoknow/config.py - Domain models · Tracked-item, report, and severity records.
src/firsttoknow/models.py - Manifest scanner
src/firsttoknow/scanner.py
Briefing Pipeline
Agent-driven research and prioritized synthesis.
- ADK briefing agent · Dynamically selects research tools for each briefing.
src/firsttoknow/agents/agent.py - Briefing instructions
src/firsttoknow/agents/instructions/briefing.py - Intelligence tools · Centralizes live registry, code, discussion, and vulnerability calls.
src/firsttoknow/agents/_tools.py - LiteLLM providers · Routes to hosted or local language models.
- Registries & community sources · PyPI, npm, GitHub, Hacker News, Dev.to, and Reddit.
Pre-push Guard
Dependency risk checks before code is pushed.
- Dependency guard · Checks newly introduced dependencies and optional source diffs.
src/firsttoknow/guard.py - Typosquat detection
src/firsttoknow/typosquat.py - Git hook support · Installs and invokes the guard at the pre-push control point.
src/firsttoknow/hooks.py - Local Git repository
Other components
- OSV.dev · CVE and vulnerability lookup source.
- Rich renderer · Renders progress, briefings, status, and guard reports.
src/firsttoknow/renderer.py
Connections 20
- Python entry point → Typer CLI: delegates
- Typer CLI → User config & tracked state: reads and writes
- Typer CLI → Domain models: uses
- Typer CLI → Manifest scanner: runs scan
- Manifest scanner → User config & tracked state: stores discovered targets
- Typer CLI → ADK briefing agent: runs brief
- User config & tracked state → ADK briefing agent: loads tracked items and model settings
- ADK briefing agent → Briefing instructions: uses
- ADK briefing agent → Intelligence tools: selects dynamically
- ADK briefing agent → LiteLLM providers: synthesizes via
- Intelligence tools → Registries & community sources: fetches context
- Intelligence tools → OSV.dev: queries vulnerabilities
- Typer CLI → Dependency guard: runs guard
- Git hook support → Dependency guard: invokes pre-push
- Local Git repository → Dependency guard: provides diffs
- Dependency guard → OSV.dev: checks vulnerabilities
- Dependency guard → Typosquat detection: checks package names
- ADK briefing agent → Rich renderer: briefing output
- Dependency guard → Rich renderer: guard report
- Typer CLI → Rich renderer: renders status