Architecture

System Overview

TownOps Skill is a municipal operations service built for NandaHack. It provides a structured API that autonomous agents can use to report, triage, assign, and resolve town issues. The system is designed around three core principles: structured schemas, deterministic workflows, and agent-first design.

What the Service Does

TownOps Skill is a structured municipal operations service for NANDA Town. It provides live API endpoints that let autonomous agents report, classify, prioritize, assign, update, and resolve town issues through a deterministic workflow pipeline. The service is designed so that another agent can use it correctly from the SKILL.md alone.

Why It's Useful in NANDA Town

NANDA Town generates many small operational issues — water leaks, broken streetlights, trash overflow, unsafe crossings. The hard part is not just seeing these issues but handling them consistently. TownOps Skill creates a structured service that autonomous agents can operate, ensuring every issue gets classified, prioritized, assigned, and tracked through to resolution.

How the Endpoints Work

The service exposes 8 structured endpoints with strict Zod schema validation. Every request is validated before processing. The workflow follows: create_issue → classify_issue → priority_score → assign_issue → update_status → generate_update. Each endpoint returns predictable JSON with success/error fields and typed data.

Why the SKILL.md Is Central

The SKILL.md is the most important artifact. It's a self-contained instruction document that any autonomous agent can read to understand how to use the entire service. It includes endpoint specifications, input/output formats, error handling, and best practices. This means agents don't need human guidance — they read the SKILL.md and operate the workflow independently.

What Is AI-Driven

AI (via NVIDIA NIM) is used for: issue classification (type, severity, urgency), priority explanation generation, zone summary generation, and resident-facing update drafting. The AI layer adds natural language understanding and communication quality to the structured pipeline.

What Is Deterministic

Workflow state transitions are strictly deterministic. Valid transitions are hardcoded (reported → triaged → assigned → in_progress → resolved). Schema validation is mandatory on every endpoint. Priority scoring uses weighted deterministic factors. If AI fails, fallback rule-based logic ensures the system still works correctly.

Why Another Agent Can Use This Autonomously

The combination of structured endpoints, strict schemas, the SKILL.md, and deterministic state management means any agent with HTTP capabilities can read the SKILL.md and immediately operate the full workflow. No human instruction needed. No UI required. No ambiguous language. Just structured API calls with predictable responses.

Agent Workflow Data Flow

1
Agent reads SKILL.md
2
Agent calls POST /api/issues
3
Service validates with Zod
4
AI classifies issue (NVIDIA NIM)
5
Priority engine scores (deterministic)
6
Agent calls POST /api/issues/{id}/assign
7
Assignment engine routes to department
8
Agent calls POST /api/issues/{id}/status
9
Status transitions validated
10
Agent calls POST /api/issues/{id}/resident-update
11
AI generates resident-facing message
12
Issue lifecycle complete

Technology Stack

Next.js 15
Framework
TypeScript
Language
Tailwind CSS
Styling
Zod
Schema Validation
SQLite
Storage
NVIDIA NIM
AI Inference
Lucide React
Icons

Issue Lifecycle State Machine

reported
→
triaged
→
assigned
→
in progress
→
resolved
blocked

Valid transitions are enforced at the API level. Invalid transitions return 400 errors.