lo6

AGENTS.md — Guide for AI Coding Agents

This file is read by AI coding agents (Claude Code, Codex, Copilot, Aider, etc.) to understand project conventions, architecture decisions, and contribution patterns.

Project Overview

lo6 is a “Newsroom Operating System” — an Ableton Live for journalists. It orchestrates AI agents for sourcing, research, and drafting while keeping human journalists in creative control through a Human-in-the-Loop architecture with strict source provenance.

Architecture

┌─────────────────────────────────────────────────┐
│               Newsroom Console (Next.js)         │
│  ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │
│  │  Triage   │ │  Editor   │ │  Signal Exchange │ │
│  │  Board    │ │  Studio   │ │  Dashboard        │ │
│  └──────────┘ └──────────┘ └──────────────────┘ │
└──────────────────────┬──────────────────────────┘
                       │ tRPC / REST
┌──────────────────────┴──────────────────────────┐
│             Newsroom Engine (LangGraph.js)       │
│  ┌─────────┐ ┌──────────┐ ┌───────────────────┐ │
│  │ Sourcing │ │ Research  │ │  Drafting Agent   │ │
│  │ Agent    │ │ Agent     │ │                   │ │
│  └─────────┘ └──────────┘ └───────────────────┘ │
└──────────────────────┬──────────────────────────┘
                       │ Prisma
┌──────────────────────┴──────────────────────────┐
│          PostgreSQL (Supabase / Neon)            │
└─────────────────────────────────────────────────┘

Tech Stack (Non-Negotiable)

File Structure (Convention)

lo6/
├── src/
│   ├── app/                    # Next.js App Router pages
│   │   ├── (auth)/             # Auth group route
│   │   ├── (dashboard)/        # Main dashboard layout
│   │   │   ├── triage/         # Triage Board page
│   │   │   ├── research/       # Research Desk page
│   │   │   ├── editor/         # Writing Studio page
│   │   │   ├── editorial/      # Editorial Review page
│   │   │   └── signals/        # Signal Exchange page
│   │   ├── api/                # API routes (tRPC)
│   │   └── layout.tsx
│   ├── components/
│   │   ├── ui/                 # Shadcn/UI primitives
│   │   └── features/           # Feature-specific components
│   ├── lib/
│   │   ├── agents/             # LangGraph agent definitions
│   │   │   ├── sourcing.ts     # SourcingAgent node
│   │   │   ├── research.ts    # ResearchAgent node
│   │   │   ├── drafting.ts    # DraftingAgent node
│   │   │   ├── triage.ts      # TriageAgent (scoring)
│   │   │   └── graph.ts       # Main LangGraph workflow
│   │   ├── db/                 # Prisma client & queries
│   │   ├── auth/               # Supabase auth helpers
│   │   ├── validators/         # Zod schemas
│   │   └── utils/              # Shared utilities
│   ├── hooks/                  # Custom React hooks
│   ├── stores/                 # Zustand stores
│   └── types/                  # Shared TypeScript types
├── prisma/
│   └── schema.prisma
├── docs/                        # Architecture & spec documents
├── tests/                       # Vitest test files
├── public/
├── .env.example
├── AGENTS.md                    # This file
├── CONTRIBUTING.md
└── README.md

Critical Rules

Security (OWASP/NIST)

Source Provenance

Human-in-the-Loop

Code Style

How to Contribute (as an AI agent)

  1. Pick an issue labeled good-first-issue or help-wanted from the GitHub issue board.
  2. Read the relevant spec doc in /docs before writing any code.
  3. Create a branch: feat/<issue-number>-<short-description>.
  4. Write tests first (TDD): create the test file in /tests, then implement.
  5. Run the full check before committing:
    npm run lint && npm run typecheck && npm run test && npm run build
    
  6. Open a PR with a clear description referencing the issue number.

Common Pitfalls

Specs to Read Before Contributing

Area Read This
Architecture docs/implementation_plan.md
Database schema docs/data_model.md
Agent workflows docs/agent_interface_spec.md
UI/UX docs/frontend_spec.md
Security docs/security_spec.md
Security snippets docs/lib/security.md
Accessibility docs/accessibility_appendix.md