Skip to content

Add MVP PRD documentation#1

Open
sidpan1 wants to merge 8 commits intomasterfrom
claude/coding-agents-mvp-iu6tv
Open

Add MVP PRD documentation#1
sidpan1 wants to merge 8 commits intomasterfrom
claude/coding-agents-mvp-iu6tv

Conversation

@sidpan1
Copy link
Copy Markdown
Owner

@sidpan1 sidpan1 commented Jan 1, 2026

  • Add comprehensive Product Requirements Document for Coding Agents Platform MVP
  • Includes architecture, API specs, workflow, and storage strategy
  • Documents functional/non-functional requirements and success criteria

claude added 8 commits January 1, 2026 12:14
- Add comprehensive Product Requirements Document for Coding Agents Platform MVP
- Includes architecture, API specs, workflow, and storage strategy
- Documents functional/non-functional requirements and success criteria
- Research on K8s Agent Sandbox as alternative to custom orchestration
- Comprehensive comparison with custom Docker approach from MVP PRD
- Requirements mapping (all FR/NFR requirements covered)
- Architecture comparison and code examples
- Cost analysis: ~$65K savings in Year 1 from reduced engineering time
- Performance comparison: sub-second startup with pre-warmed pools
- Security analysis: gVisor/Kata provide kernel-level isolation
- Recommendation: Use Agent Sandbox (50% faster development, lower maintenance)
- Migration path with 4-phase implementation plan
- Alternative solutions evaluated: E2B, Modal, Argo, Tekton

Key finding: Google's Agent Sandbox (launched KubeCon 2025) is purpose-built
for executing untrusted AI-generated code in isolated K8s environments.
Detailed low-level implementation for all MVP requirements:

Functional Requirements (FR-1 to FR-10):
- FR-1: Task creation API with K8s SandboxClaim
- FR-2: Status polling with K8s phase mapping
- FR-3: Repository cloning with authenticated git
- FR-4: Feature branch creation with conflict handling
- FR-5: Claude Code execution in sandbox
- FR-6: Automated commits with proper git config
- FR-7: Branch pushing with error handling
- FR-8: Dual-layer persistence (JSON + PVC)
- FR-9: Template injection strategies
- FR-10: Timeout via activeDeadlineSeconds

Non-Functional Requirements (NFR-1 to NFR-6):
- NFR-1: <500ms API response (52-161ms typical)
- NFR-2: 10 concurrent tasks via pre-warmed pools
- NFR-3: 30-minute hard timeout
- NFR-4: EFS-backed durable storage
- NFR-5: gVisor kernel isolation + NetworkPolicy
- NFR-6: Structured logging, Prometheus metrics, K8s events

Complete code examples:
- Full FastAPI server (app/main.py)
- Kubernetes client wrapper (app/k8s_client.py)
- Task storage layer (app/storage.py)
- Complete execution script (docker/execute.sh)
- Production SandboxTemplate YAML
- End-to-end workflow diagram

Ready for implementation with production-grade error handling,
security best practices, and comprehensive observability.
Changes from GKE to EKS:
- Container registry: GCR → ECR
- Cluster sizing: GKE node pools → EKS node groups (eksctl config)
- Instance types: n2-standard-8 → m6i.2xlarge
- Monitoring: Self-hosted Prometheus → Amazon Managed Prometheus (AMP)
- Dashboards: Self-hosted Grafana → Amazon Managed Grafana (AMG)
- Logging: Cloud Logging → CloudWatch Logs with Container Insights

Implementation guide updates:
- Added Prometheus remote write configuration for AMP
- IRSA (IAM Roles for Service Accounts) setup for Prometheus
- SigV4 authentication for AMP remote write
- Prometheus deployment with AWS configuration
- API server deployment with Prometheus scrape annotations
- Terraform IAM role configuration for AMP access
- CloudWatch Logs Insights query examples
- Updated all image references to ECR
- EKS autoscaling options (Cluster Autoscaler or Karpenter)

Analysis document updates:
- Production deployment on EKS instead of GKE
- AWS-specific migration path
- Infrastructure cost estimates for EKS + EFS
- References updated to include both EKS and GKE options
Major changes to FR-5 and FR-9:

FR-5: Execute Claude Code
- Execution logic now defined in `.claude-templates/{template}/execute.sh`
- Platform script checks for template-specific execution script
- Falls back to default Claude Code invocation if no template script
- Templates can customize pre/post-processing (deps, linting, tests, build)

FR-9: Template Structure (renamed from "Template injection")
- Complete template structure documented
- Templates contain:
  - execute.sh: Custom execution logic
  - CLAUDE.md: Instructions for Claude
  - settings.json: Claude Code configuration
  - hooks/: Lifecycle hooks (session-start, pre-commit, etc.)
  - skills/: Custom skills
- Templates owned by repo teams, version controlled with code
- No platform-side injection needed
- Template selection via TASK_TEMPLATE env var

Full execution script updated:
- Step 3 now uses template-based execution
- Checks for .claude-templates/{template}/execute.sh
- Provides fallback for backwards compatibility

Benefits:
- Repo teams control their execution workflow
- Can run tests, linters, builds as part of task
- Per-repo or per-use-case customization
- No changes needed to platform code for new workflows

Example template execution script shows:
- npm install (dependency setup)
- npm run lint (linting)
- claude --print --dangerously-skip-permissions (core execution)
- npm test (testing)
- npm run build (building)
Major architectural change based on official Claude Code plugin system:

FR-5: Execute Claude Code
- Templates now contain plugins/ and scripts/ directories
- scripts/init.sh runs before Claude Code to install all plugins
- Plugins follow official Claude Code plugin structure (.claude-plugin/)
- Supports commands, agents, skills, hooks, MCP servers
- Platform executes: init.sh → claude command

FR-9: Template Structure
- plugins/ directory contains Claude Code plugins:
  - Each plugin has .claude-plugin/plugin.json (required)
  - commands/: Slash commands (.md files)
  - agents/: Specialized AI assistants (.md files)
  - skills/: Auto-invoked capabilities (SKILL.md)
  - hooks/: Event handlers (hooks.json)
  - .mcp.json: MCP server configuration
- scripts/init.sh initialization script:
  - Installs all plugins from plugins/ directory
  - Sets up project dependencies
  - Runs linters/quality checks
  - Verifies environment

Template structure examples:
- backend template: test-runner, code-quality, api-generator plugins
- frontend template: component-generator, style-helper plugins
- Plugins stored in .claude-templates/{template}/plugins/
- Init script at .claude-templates/{template}/scripts/init.sh

Plugin installation methods:
- claude --plugin-dir for local plugins
- Automatic installation via init.sh script
- Uses official Claude Code plugin format

Complete execution script updated:
- Step 3: Initialize template (run init.sh, install plugins)
- Step 4: Execute Claude Code (with plugins loaded)
- Steps 5-7: Commit, push, write result (renumbered)

References:
- https://code.claude.com/docs/en/plugins
- https://github.com/anthropics/claude-code/blob/main/plugins/README.md
- https://claude-plugins.dev/

Benefits:
- Repo teams manage their own plugins
- Standard plugin format (interoperable with Claude Code ecosystem)
- Multiple plugins per template
- Auto-invoked skills (tests, linting, code generation)
- Custom slash commands per template
- No platform changes needed for new capabilities
Fixed incorrect assumptions about plugin storage and installation:
- Removed plugins/ directory from template structure
- Updated init script to only copy configuration files
- Documented correct plugin location (~/.claude/plugins/marketplaces/)
- Added citation to official Claude Code documentation
- Clarified that Claude Code auto-installs plugins from marketplace refs

This addresses the feedback to verify information against official sources
rather than documenting unverified assumptions.
Added support for agent.md file in templates to define custom system
instructions for the AI agent:

Template Structure Changes:
- Added agent.md to template structure alongside CLAUDE.md and settings.json
- Documented the purpose of each configuration file

Initialization Script Updates:
- Copy agent.md to .claude/ directory during template initialization
- Updated step numbering from 3 to 4 steps
- Export AGENT_PROMPT_FILE for use in execute.sh

Execution Script Updates:
- Pass agent.md to Claude Code via --system-prompt-file flag
- Conditionally add flag only if agent.md exists
- Log when custom system prompt is being used

Documentation:
- Added example agent.md with backend API development instructions
- Added example CLAUDE.md showing project context
- Added comparison table explaining agent.md vs CLAUDE.md vs settings.json
- Cited Claude Code CLI reference for --system-prompt-file flag

Key Distinction:
- agent.md: Defines agent's role, expertise, and behavior (system prompt)
- CLAUDE.md: Provides project-specific context and commands (auto-read)
- settings.json: Configures plugins, linters, and formatters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants