Listen to this Post

Introduction:
Garbology NYC is a progressive web application (PWA) developed at the New York Public Library × Major League Hacking “Built for NYC” hackathon 2026 that transforms street cleanup into a verifiable, reputation-based economic activity. The platform integrates NYC Open Data—including 311 sanitation complaints, DSNY Scorecard ratings, and litter basket inventories—with a multi-agent AI system that verifies before/after cleanup photos, matches volunteers to real bounties, and enables storefronts to hire based on verified track records rather than identity or credentials. This represents a novel intersection of civic technology, AI-powered fraud prevention, and economic mobility infrastructure.
Learning Objectives:
- Understand how to integrate NYC Open Data APIs (311 Service Requests, DSNY Scorecard, Litter Basket Inventory) into a civic application
- Learn the architecture of a multi-agent AI verification system with network-level security cages
- Implement progressive web app (PWA) features for offline-capable, cross-platform deployment
- Apply computer vision techniques (EXIF analysis, perceptual hashing, Claude Vision) for fraud detection in user-submitted content
- Design inclusive interfaces with multilingual support (Local Law 30 compliance) and voice-based interaction
You Should Know:
- NYC Open Data Integration: The Backbone of Civic Gamification
Garbology NYC leverages three primary NYC Open Data datasets to power its game mechanics:
- 311 Service Requests (dataset ID: erm2-1we9): All sanitation complaints filed with 311 become map bounties. The application queries this dataset to display real, open complaints within a 150-meter radius of the user.
-
DSNY Scorecard (dataset ID: rqhp-hivt): District cleanliness ratings determine multiplier effects—2× in areas rated dirtiest (76% clean in the Bronx vs. 99% in Queens). The Scorecard’s value column is still named
acceptable_streets_feb_2014, highlighting the importance of inspecting API responses directly rather than relying on documentation. -
DSNY Litter Basket Inventory (dataset ID: 8znf-7b2c): 20,413 basket locations show users where to dispose of collected trash.
Step-by-Step Guide: Querying NYC Open Data via SODA API
Example: Fetch open sanitation complaints using Socrata Open Data API (SODA)
Replace APP_TOKEN with your NYC Open Data application token
curl -X GET "https://data.cityofnewyork.us/resource/erm2-1we9.json" \
-H "X-App-Token: YOUR_APP_TOKEN" \
-d '$where=complaint_type="Dirty Condition" AND status="Open" AND within_circle(location, 40.7128, -74.0060, 150)'
Filter by borough and date range
curl -X GET "https://data.cityofnewyork.us/resource/erm2-1we9.json" \
-H "X-App-Token: YOUR_APP_TOKEN" \
-d '$where=borough="BRONX" AND created_date > "2026-08-01"'
Using Python with pandas and sodapy
from sodapy import Socrata
client = Socrata("data.cityofnewyork.us", "YOUR_APP_TOKEN")
results = client.get("erm2-1we9",
complaint_type="Dirty Condition",
status="Open",
limit=100)
Windows PowerShell Alternative:
Using Invoke-RestMethod
$headers = @{"X-App-Token" = "YOUR_APP_TOKEN"}
$uri = "https://data.cityofnewyork.us/resource/erm2-1we9.json?`$where=complaint_type='Dirty Condition' AND status='Open'"
$response = Invoke-RestMethod -Uri $uri -Headers $headers
$response | ConvertTo-Json -Depth 3
2. Multi-Agent AI Architecture with Network-Level Security
The platform employs four specialized AI agents with declared personas, goals, and tool belts, all publicly traced on an in-app Agent Ops dashboard:
- Sentinel (Verification Agent): Runs inside a Runta security cage with deny-all egress except two whitelisted hosts. The request to Claude Vision carries no API key—Runta injects credentials at the network boundary, ensuring a prompt-injected agent cannot leak a secret it never held.
-
Curator (Data Normalization Agent): Processes and normalizes NYC Open Data for application use.
-
Dispatcher (Matching Agent): Ranks gig applicants with an empty egress allowlist—no network, no identity signals.
-
Scrap (Voice Concierge Agent): Handles voice interactions via ElevenLabs Agents with client-side tools.
Step-by-Step Guide: Implementing a Caged AI Verification Pipeline
Pseudo-code for multi-layer verification (cheap-to-expensive ordering)
from PIL import Image
import imagehash
from exif import Image as ExifImage
import requests
def verify_cleanup(before_path, after_path, gps_coords):
Layer 1: EXIF freshness and GPS validation (cost: $0)
before_exif = ExifImage(open(before_path, 'rb'))
after_exif = ExifImage(open(after_path, 'rb'))
Check photos were taken within reasonable timeframe
if not validate_timestamps(before_exif, after_exif):
return {"verified": False, "reason": "timestamp_mismatch"}
Validate GPS matches claimed location
if not validate_gps(before_exif, gps_coords):
return {"verified": False, "reason": "gps_mismatch"}
Layer 2: Perceptual hash for same-scene detection (cost: $0)
before_hash = imagehash.phash(Image.open(before_path))
after_hash = imagehash.phash(Image.open(after_path))
if before_hash == after_hash:
return {"verified": False, "reason": "identical_image"}
Hamming distance check for duplicate detection
if imagehash.hex_to_hash(before_hash) - imagehash.hex_to_hash(after_hash) < 5:
return {"verified": False, "reason": "same_scene"}
Layer 3: Caged Claude Vision (cost: ~0.001 per verification)
Request sent through Runta cage - no API key in request
response = requests.post(
"https://runta-cage.example.com/vision",
json={
"image_before": before_path,
"image_after": after_path,
"prompt": "Verify this before/after cleanup shows real litter removal"
}
)
return response.json()
- Progressive Web App (PWA) Architecture for Offline-First Deployment
Built with Next.js 16 + TypeScript + SQLite, the application runs with zero credentials—judges can execute `npm i && npm run dev` with no API keys required. The PWA architecture enables:
- Offline capability with local SQLite database (Vercel’s read-only filesystem required a `/tmp` SQLite with cold-start self-seeding from bundled snapshots)
- Leaflet + CARTO for mapping with no map token required
- React Three Fiber for 3D “Trash Monster” visualization per district
- Light/dark themes with WCAG-AA accessibility compliance
Step-by-Step Guide: Setting Up a Zero-credential PWA with SQLite
Initialize Next.js project with TypeScript npx create-1ext-app@latest garbology-1yc --typescript --tailwind --app Install dependencies npm install sqlite3 better-sqlite3 leaflet react-leaflet @react-three/fiber @react-three/drei Configure SQLite for serverless (Vercel-compatible) Create lib/db.ts:
// lib/db.ts - SQLite with cold-start seeding
import Database from 'better-sqlite3';
import fs from 'fs';
import path from 'path';
const DB_PATH = '/tmp/garbology.db';
const SEED_PATH = path.join(process.cwd(), 'seed-data.sqlite');
export function getDb() {
if (!fs.existsSync(DB_PATH)) {
fs.copyFileSync(SEED_PATH, DB_PATH);
}
return new Database(DB_PATH);
}
// Example: Query open 311 complaints
export function getOpenComplaints(lat: number, lng: number, radius: number) {
const db = getDb();
return db.prepare(<code>SELECT FROM complaints
WHERE status = 'Open'
AND (6371 acos(cos(radians(?)) cos(radians(lat)) cos(radians(lng) - radians(?)) + sin(radians(?)) sin(radians(lat)))) <= ?</code>).all(lat, lng, lat, radius / 1000);
}
4. Multilingual Accessibility and Local Law 30 Compliance
The interface ships in seven of NYC’s Local Law 30 designated languages—English, Spanish, Chinese, Russian, Korean, Bengali, and Haitian Creole. Local Law 30 of 2017 requires covered city agencies to translate commonly distributed documents into the top 10 citywide languages and provide telephonic interpretation in at least 100 languages.
The voice concierge (Scrap) handles the entire flow—registering a shop, posting a gig, hiring—in five languages, with Bengali and Haitian Creole pending voice platform support. The text UI supports all seven languages through machine-translated catalogs with a community review mechanism planned.
Step-by-Step Guide: Implementing i18n in Next.js
Install next-intl for internationalization npm install next-intl Directory structure messages/ en.json es.json zh.json ru.json ko.json bn.json ht.json
// middleware.ts - Locale detection and routing
import createMiddleware from 'next-intl/middleware';
export default createMiddleware({
locales: ['en', 'es', 'zh', 'ru', 'ko', 'bn', 'ht'],
defaultLocale: 'en'
});
export const config = {
matcher: ['/', '/(en|es|zh|ru|ko|bn|ht)/:path']
};
// components/VoiceAgent.tsx - ElevenLabs voice integration
import { useVoiceAgent } from '@elevenlabs/react';
function VoiceConcierge({ locale }: { locale: string }) {
const agent = useVoiceAgent({
agentId: process.env.NEXT_PUBLIC_ELEVENLABS_AGENT_ID,
language: locale // 'en', 'es', 'zh', 'ru', 'ko'
});
return (
<button onClick={() => agent.start()}>
🗣️ Speak to Scrap
</button>
);
}
5. Economic Mobility Infrastructure: Verified Reputation Over Identity
The core principle of Garbology NYC is that verified work—not identity or credentials—determines economic opportunity. NYC Admin Code §16-118 and §16-123 make storefronts liable for sidewalk and snow clearance, with over 123,000 cleanliness summonses issued in the first half of 2024 alone at $100–$250 each.
Businesses post gigs with real rewards (cash, food, store credit) and set an XP bar. The Dispatcher agent ranks applicants purely on verified track record: cleanups completed, streaks maintained, and proximity to the gig location—never identity, never credentials.
Step-by-Step Guide: Implementing Reputation-Based Matching
// lib/dispatcher.ts - Zero-1etwork ranking agent
interface Applicant {
id: string;
verified_cleanups: number;
current_streak: number;
max_streak: number;
avg_proximity: number; // average distance to completed gigs
}
function rankApplicants(
applicants: Applicant[],
gigLocation: {lat: number, lng: number}
): { ranked: Applicant[]; reasons: string[] } {
// No network calls - runs entirely locally
// No identity signals - only verified work metrics
const scored = applicants.map(a => {
const proximityScore = 1 / (1 + haversineDistance(a.avg_proximity, gigLocation));
const cleanupScore = Math.log10(a.verified_cleanups + 1) 10;
const streakBonus = a.current_streak / (a.max_streak || 1) 5;
return {
...a,
score: proximityScore 0.4 + cleanupScore 0.4 + streakBonus 0.2,
reason: `Proximity: ${proximityScore.toFixed(2)}, Cleanups: ${a.verified_cleanups}, Streak: ${a.current_streak} days`
};
});
return {
ranked: scored.sort((a, b) => b.score - a.score),
reasons: scored.map(a => a.reason)
};
}
6. Anti-Fraud Defense-in-Depth: Cheap-to-Expensive Ordering
The verification pipeline orders defenses from cheapest to most expensive, making fraud free to reject and trust cheap to earn:
- EXIF Freshness + GPS Validation ($0): Verifies photo timestamps and geolocation match claimed cleanup time and location
- Perceptual dHash for Same-Scene Detection ($0): Detects if before/after photos are of the same scene or if the “after” photo was taken elsewhere
- Duplicate Detection ($0): Prevents reuse of the same photo across multiple submissions
- Caged Claude Vision (~$0.001 per verification): AI-powered verification that a cleanup actually occurred
Step-by-Step Guide: Implementing Perceptual Hashing
Install imagehash library pip install Pillow imagehash Run perceptual hash comparison
verify_hash.py
from PIL import Image
import imagehash
import sys
def verify_images(before_path, after_path):
before = Image.open(before_path)
after = Image.open(after_path)
Perceptual hash - robust to resizing and minor edits
before_hash = imagehash.phash(before)
after_hash = imagehash.phash(after)
Hamming distance - lower = more similar
distance = before_hash - after_hash
print(f"Hash distance: {distance}")
if distance < 5:
print("WARNING: Images are too similar - possible fraud")
return False
else:
print("Images appear different - passing initial check")
return True
if <strong>name</strong> == "<strong>main</strong>":
verify_images(sys.argv[bash], sys.argv[bash])
What Undercode Say:
- Key Takeaway 1: Network-level security cages (Runta) represent a paradigm shift in AI agent security. By injecting credentials at the network boundary rather than embedding them in agent prompts, the system achieves “keyless” AI verification—the agent physically cannot exfiltrate what it never held. This pattern is applicable beyond civic tech to any AI system handling sensitive operations.
-
Key Takeaway 2: The “cheap-to-expensive” verification ordering (EXIF → perceptual hash → vision AI) demonstrates that effective fraud prevention doesn’t require running expensive models on every request. Approximately 1,000 vision tokens (fractions of a cent) per cleanup makes the system economically viable at scale.
Analysis: Garbology NYC’s architecture reveals several principles applicable to civic technology at scale. The integration of live NYC Open Data demonstrates how cities can become platforms for citizen engagement—311 complaints become game mechanics, Scorecard ratings become difficulty multipliers, and basket inventories become navigation aids. The zero-credential deployment model (judges run `npm i && npm run dev` with no keys) lowers barriers to contribution and forkability.
The agent architecture is particularly noteworthy. Four specialized agents with declared personas and tool belts, each with different security postures (Sentinel: caged with egress allowlist; Dispatcher: zero network; Scrap: client-side tools), represents a more mature approach than monolithic AI systems. The in-app Agent Ops dashboard publicly traces tools, tokens, and goals—an accountability mechanism that builds trust.
However, challenges remain. The team documented API discrepancies across three platforms (Runta, ElevenLabs, Socrata), highlighting the gap between API marketing and implementation. Bengali and Haitian Creole—both Local Law 30 languages—lack voice platform support, a gap the team honestly documented. The 17-second verification time from a Vercel serverless function is impressive but may need optimization for real-time use at scale.
Prediction:
- +1 Garbology NYC’s model of AI-verified reputation replacing traditional credentials could scale to other civic domains—pothole reporting, graffiti removal, snow clearing—creating a new category of “verifiable work” that enables economic mobility for individuals without formal resumes.
-
+1 The multi-agent architecture with network-level security cages will influence AI security best practices, particularly for applications where agents handle sensitive operations or user data.
-
-1 API fragmentation and undocumented breaking changes (e.g., NYC 311 renaming complaint types mid-history) pose sustainability risks for civic tech projects dependent on government data infrastructure. The team’s honest DX journal documenting integration papercuts may become a necessary standard for future civic tech projects.
-
+1 The 311 write-back feature—auto-closing matching complaints with photo evidence via city API partnership—could reduce city sanitation department workload while providing real-time validation of citizen contributions, creating a win-win public-private data feedback loop.
-
-1 Without city API partnership for write-back and escrowed cash gigs via Stripe Connect, the platform remains a demonstration rather than a self-sustaining economic system. The path to production depends on city government adoption and integration with existing sanitation workflows.
▶️ Related Video (86% Match):
https://www.youtube.com/watch?v=_nXHvOsu9VM
🎯Let’s Practice For Free:
🎓 Live Courses & Certifications:
Join Undercode Academy for Verified Certifications
🚀 Request a Custom Project:
Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
[email protected]
💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands
IT/Security Reporter URL:
Reported By: https://lnkd.in/p/eEqRXnbw – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅


