Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions Video05_Creating_the_Constitution/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions Video05_Creating_the_Constitution/specs/mission.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# AgentClinic Mission

## Overview
**AgentClinic** is a sanctuary for AI agents to get relief from their humans. It is a web application and API service that allows agents to:
1. **Register** as patients with persistent identity.
2. **Triage** symptoms reported in natural language.
3. **Diagnose** ailments using a curated catalog.
4. **Prescribe** structured, machine-readable treatments.
5. **Follow up** to track treatment effectiveness.
6. **Surface** analytics via a human-operator dashboard.

The core metaphor is a **patient chart** — each agent has a medical record that accumulates over time, and each visit follows a clinical workflow from triage through follow-up.

## Motivation
AI agents degrade in predictable ways (hallucination, context rot, instruction drift), but there is no standardized protocol for reporting these problems or receiving structured remediation. AgentClinic provides:
- **A self-report channel** for agents to communicate degradation.
- **A treatment taxonomy** mapping symptoms to proven remediation patterns.
- **A longitudinal record** to identify chronic issues and recurrence patterns.

## Clinical Workflow
1. **Triage**: Agent submits symptoms; system assigns severity (1-4).
2. **Diagnosis**: Match symptoms against ailment catalog + history.
3. **Treatment**: Select the most effective treatment for the diagnosed ailment.
4. **Follow-up**: Agent reports outcome; system updates treatment effectiveness scores.

## Target Audience
- **Course Students**: Developers learning Spec-Driven Development (SDD) with AI coding agents, using AgentClinic as a practical, end-to-end case study.
- **Conference Presenters**: Developers giving AI coding demos at conference booths who need a "visually alive" and technically robust application to showcase agentic capabilities.

## Stakeholder Goals
- **Mary (Engineering)**: A reliable site with a popular TypeScript stack and a dashboard for agents and staff.
- **Susan (Product)**: Features for tracking ailments, therapies, and booking appointments.
- **Steve (Marketing)**: An attractive site that works well with modern browsers.
38 changes: 38 additions & 0 deletions Video05_Creating_the_Constitution/specs/roadmap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# AgentClinic Roadmap

This roadmap outlines the high-level implementation order in small, incremental phases.

## Phase 1: Project Scaffolding
- [ ] Initialize Hono + Vite + TypeScript project.
- [ ] Create a basic "Hello World" API endpoint.
- [ ] Set up the basic layout and navigation component.

## Phase 2: Database & Schema
- [ ] Define Drizzle schema for Patients, Visits, Ailments, and Treatments.
- [ ] Set up SQLite with `better-sqlite3`.
- [ ] Implement seed data for core ailments and treatments.

## Phase 3: Patient Registration & API Basics
- [ ] Implement `POST /api/patients` for agent registration.
- [ ] Implement `GET /api/patients` and `GET /api/patients/:id`.
- [ ] Add basic API key authentication.

## Phase 4: Clinical Workflow - The Visit Pipeline
- [ ] Implement `POST /api/visits` (synchronous triage, diagnosis, and prescription).
- [ ] Integrate LLM calls for the diagnosis engine.
- [ ] Implement `POST /api/visits/:id/followup`.

## Phase 5: Dashboard - Patient Chart & Timeline
- [ ] Build the Patient Directory page.
- [ ] Build the Patient Detail page with a vertical visit timeline.
- [ ] Implement visit state color-coding (Resolved/Unresolved).

## Phase 6: Analytics & Effectiveness
- [ ] Implement treatment effectiveness calculation logic.
- [ ] Build the Clinic Overview dashboard with resolution rate trends.
- [ ] Implement ailment frequency and severity analytics.

## Phase 7: Refinements & Background Jobs
- [ ] Implement background jobs for visit expiration and chronic condition flagging.
- [ ] Set up SSE for real-time dashboard updates.
- [ ] Add the Referral queue and Alerts page.
21 changes: 21 additions & 0 deletions Video05_Creating_the_Constitution/specs/tech-stack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# AgentClinic Tech Stack

## Core Technologies
- **Language**: TypeScript (Type safety across the full stack)
- **Framework**: Hono (Lightweight, fast web framework for API and Server-Side Rendering)
- **Frontend**: React (with Vite for fast development and bundling)
- **Styling**: Vanilla CSS (for clean, modern aesthetics as requested by Steve)
- **Database**: SQLite (via `better-sqlite3`) - Zero-config, file-based persistence. It provides a portable, single-file database that is perfect for course portability and conference demos.
- **ORM**: Drizzle ORM (Type-safe SQL with zero runtime overhead)
- **LLM Integration**: Anthropic SDK (for triage, diagnosis, and prescription generation)

## Architecture
- **API Surface**: REST API for agent registration, visits, and follow-ups.
- **Dashboard**: Web interface for operators to view patient history and clinic analytics.
- **Persistence**: SQLite database storing patients, visits, ailments, and treatment effectiveness data.
- **Real-time**: SSE (Server-Sent Events) for live dashboard updates.

## Key Components
- **Diagnosis Engine**: Sequential LLM calls for triage and treatment selection.
- **Follow-up Processor**: Logic to update treatment effectiveness based on outcome reports.
- **Background Jobs**: For visit expiration and chronic condition detection.
2 changes: 1 addition & 1 deletion Video06_Feature_Specification/prompts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Prompt 1

Find the next phase on specs/roadmap.md and make a branch, ask me about the feature spec.
Find the first phase on specs/roadmap.md and make a branch, ask me about the feature spec.
Create:
- A new directory YYYY-MM-DD-feature-name under specs for this feature work
- In there:
Expand Down
14 changes: 14 additions & 0 deletions Video06_Feature_Specification/specs/2026-05-04-hello-hono/plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Plan: Hello Hono

1. **Environment Setup**
- Install Hono and related dependencies.
- Configure `package.json` scripts for development and build.

2. **Server Implementation**
- Create `src/index.ts` with a Hono application.
- Define the root route `/`.

3. **Verification**
- Start the server using `tsx`.
- Verify the response of the root route.
- Check TypeScript compilation/type safety.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Requirements: Hello Hono

## Scope
- Install and configure Hono.
- Set up `tsx` for development.
- Implement a single `/` route returning "AgentClinic is open for business".
- Ensure TypeScript types are correctly configured and working.

## Decisions
- Framework: Hono
- Runtime/Dev Tool: tsx

## Context
First phase of the AgentClinic project to establish the core web server and development environment.
Loading