GritFlow
Back to Documentation
Structured Workflow

The PACT Framework

Prepare. Architect. Code. Test. A four-phase workflow that transforms chaotic AI development into repeatable success.

12 min readAdvanced

TL;DR

PACT is a structured workflow with specialized AI agents for each phase: research before building, design before implementing, code with checklists, and validate before shipping. 10x better results than “just ask Claude.”

Why Structured AI Development?

Unstructured AI Development

  • Jump straight to code → miss edge cases
  • No research → reinvent the wheel
  • Circular fixes → same bugs return
  • No testing → ship broken code
  • Lost context → repeat mistakes

With PACT Framework

  • Research first → informed decisions
  • Architecture plans → fewer rewrites
  • Checklist-driven → predictable quality
  • Built-in QA → confident shipping
  • Session memory → compound learning
P

Prepare

Research before you build

Gather documentation, understand requirements, and build context before writing a single line of code.

Outputs

  • Research documentation
  • Competitive analysis
  • Technical requirements

Key Modules

  • context7-integration
  • session-memory
  • deep-investigation

Agent: grit-pact-preparer

A

Architect

Design before you implement

Create detailed architectural plans, identify edge cases, and define the implementation approach.

Outputs

  • Architecture diagrams
  • API contracts
  • Data models
  • Implementation plan

Key Modules

  • subtask-planning
  • verification-types
  • spec-critique

Agent: grit-pact-architect

C

Code

Build with confidence

Implement the architecture with specialized agents, pre-implementation checklists, and recovery tracking.

Outputs

  • Production-ready code
  • Unit tests
  • Documentation updates
  • Migration scripts

Key Modules

  • pre-implementation-checklist
  • self-critique
  • recovery-tracking

Agents: grit-pact-backend-coder, grit-pact-frontend-coder, grit-pact-database-engineer

T

Test

Validate before you ship

Comprehensive testing with the Test Companion, automated QA loops, and human validation.

Outputs

  • Test reports
  • Bug fixes
  • Performance metrics
  • Sign-off documentation

Key Modules

  • qa-fix-loop
  • playwright-decision-tree
  • validation-patterns

Agent: grit-pact-test-engineer

21 Reusable Prompt Modules

PACT's power comes from its modular architecture. Each module solves a specific problem and can be combined as needed.

.claude/grit-pact/modules/
├── deep-investigation.md      # Mandatory codebase analysis
├── complexity-assessment.md   # Pre-task risk analysis
├── context7-integration.md    # Library doc lookup
├── subtask-planning.md        # Breaking work into units
├── pre-implementation-checklist.md
├── self-critique.md           # Quality gate
├── recovery-tracking.md       # Prevent circular fixes
├── session-memory.md          # Cross-session persistence
├── parallel-execution.md      # Multi-agent coordination
├── insight-extractor.md       # Knowledge capture
├── qa-fix-loop.md             # Structured fix cycles
├── spec-critique.md           # Pre-coding validation
├── model-selection.md         # haiku/sonnet/opus routing
└── validation-patterns.md     # API/Browser/DB verification

Session Memory: Learning That Persists

Unlike traditional AI workflows where context is lost, PACT maintains session memory that compounds your learning over time.

.gritflow/
├── patterns.md          # Discovered patterns (reused)
├── gotchas.md           # Known issues and pitfalls
├── codebase_map.json    # Project structure
├── attempt_history.json # What's been tried
└── session_insights/    # Per-session learnings

Start Using PACT

Run your first PACT workflow with the full guide on the dedicated PACT page.

PACT Framework - GritFlow Documentation | next-forge