Skip to content

Crate Architecture Map

AgilePlus is organized into 13+ crates following hexagonal architecture. The domain layer has zero external dependencies; all I/O is abstracted via ports and adapters.

Core Domain Layer

agileplus-domain

The immutable core of the system: domain entities, state machines, port traits, and governance logic.

ModuleResponsibility
domain/Feature, WorkPackage, AuditEntry, Evidence, Metric, PolicyRule
state_machine/FSM transitions with governance gate validation
ports/StoragePort, VcsPort, AgentPort trait definitions
governance/GovernanceContract, GateViolation, rule enforcement
error/DomainError enum with strong typing

Key Types:

  • Feature { id, slug, state: FeatureState, ...}
  • WorkPackage { id, feature_id, sequence, state: WpState, ...}
  • AuditEntry { id, feature_slug, timestamp, actor, transition, hash, ... } (immutable)
  • StoragePort, VcsPort, AgentPort (async trait interfaces)

Dependencies: None (zero external crates)

Stability: Very stable. Changes here cascade to all adapters.

CLI & Entry Point

agileplus-cli

Command-line interface using clap for argument parsing and subcommand routing.

ModuleCommands
commands/specifyagileplus specify
commands/researchagileplus research
commands/planagileplus plan
commands/implementagileplus implement + agent dispatch
commands/validateagileplus validate
commands/shipagileplus ship
commands/retrospectiveagileplus retrospective
commands/triageagileplus triage
commands/queueagileplus queue {add,list,show,pop}

Key Types:

  • Cli { command: Commands, verbose: u8, db: PathBuf, repo: Option<PathBuf> }
  • Commands enum (Specify, Research, Plan, Implement, Validate, Ship, Retrospective, Triage, Queue)
  • Individual command args structs (SpecifyArgs, PlanArgs, ImplementArgs, etc.)

Dependencies: agileplus-domain, all adapter crates

Stability: Moderate. Command signatures can change with feature work.

Storage Adapters

agileplus-sqlite

SQLite adapter implementing StoragePort.

TypePurpose
SqliteStorageAdapterConnection pooling, async queries
FeatureRepositoryFeature CRUD operations
WorkPackageRepositoryWorkPackage CRUD + dependency tracking
AuditRepositoryAppend-only audit log with hash chaining
EvidenceRepositoryEvidence/governance artifact storage
MetricRepositoryPerformance metrics recording

Key Features:

  • Tokio async runtime via tokio-rusqlite
  • Connection pooling via sqlx
  • Transaction support for atomicity
  • Hash chaining for audit immutability

Dependencies: agileplus-domain, tokio, sqlx, rusqlite

Stability: Very stable. Schema changes are migrations only.

agileplus-api

RESTful HTTP adapter for remote access.

Key Routes:

  • GET /features — list features
  • POST /features — create feature
  • GET /features/:slug — get feature by slug
  • POST /features/:slug/transition — trigger state transition
  • GET /features/:slug/audit — fetch audit trail
  • GET /features/:slug/work-packages — list work packages

Dependencies: agileplus-domain, agileplus-sqlite, axum (web framework), tokio

Stability: Moderate. API may expand with new endpoints.

agileplus-grpc

gRPC service adapter (WP09) implementing AgilePlusCoreService.

Key Services:

  • Feature operations: GetFeature, ListFeatures, GetFeatureState
  • Work package operations: ListWorkPackages, GetWorkPackageStatus
  • Governance: CheckGovernanceGate, GetAuditTrail, VerifyAuditChain
  • Command dispatch: DispatchCommand, StreamAgentEvents

Dependencies: agileplus-domain, agileplus-sqlite, tonic (gRPC framework), prost (protobuf)

Stability: Moderate. Service definitions may expand.

VCS Adapters

agileplus-git

Git adapter implementing VcsPort.

TypePurpose
GitVcsAdapterWraps git2-rs for CLI-independent operations
WorktreeManagerCreates/destroys isolated worktrees
BranchManagerBranch lifecycle (create, checkout, merge)
ArtifactStoreRead/write feature artifacts
ConflictDetectorPre-merge conflict analysis
HistoryScannerAudit trail reconstruction from git log

Key Features:

  • Async via git2 (blocking) wrapped in tokio::task::spawn_blocking
  • Worktree isolation for agent workspaces
  • Merge conflict detection without applying
  • Git history reconstruction for governance audits

Dependencies: agileplus-domain, git2, tokio

Stability: Very stable. Git behavior is standardized.

Service Adapters

agileplus-triage

Triage classifier and backlog queue.

TypePurpose
TriageClassifierNLP-based classification (bug, feature, idea, task)
RouterGeneratorRoute classified items to appropriate queues
BacklogQueueIn-memory or persisted task queue

Key Features:

  • Keyword-based classification (can be replaced with ML model)
  • Priority scoring
  • Queue persistence to JSON/SQLite
  • Batch processing support

Dependencies: agileplus-domain, regex, serde

Stability: Moderate. Classification logic may improve.

agileplus-plane

Plane.so integration for project management sync.

TypePurpose
PlaneClientHTTP API wrapper
PlaneSyncAdapterBidirectional sync: Feature ↔ Plane Issue
PlaneEventListenerWebhook handler for external updates

Key Features:

  • OAuth2 authentication
  • Issue state mapping
  • Automatic PR linking
  • Rate limiting

Dependencies: agileplus-domain, reqwest, tokio

Stability: Moderate. API may change with Plane updates.

agileplus-github

GitHub integration for PR/issue tracking.

TypePurpose
GitHubClientGraphQL + REST API wrapper
GitHubSyncAdapterFeature ↔ GitHub Issue sync
PrBuilderProgrammatic PR creation from work packages
ReviewAdapterPR review status polling (CodeRabbit fallback)

Key Features:

  • GraphQL for efficient querying
  • OAuth App authentication
  • PR template rendering
  • Automated review via CodeRabbit bot
  • Merge conflict detection

Dependencies: agileplus-domain, octocrab, reqwest, tokio

Stability: Moderate. GitHub API evolves regularly.

Utility Crates

agileplus-subcmds

Hidden subcommand registry and audit system.

CategoryCommandsPurpose
branchcreate, checkout, delete, listBranch management
commitcreate, amend, fixup, rebaseCommit operations
diffshow, statDiff inspection
stashpush, pop, listStash management
worktreeadd, remove, listWorktree operations
artifactwrite, read, hashArtifact file ops
governancecheck, enforceGovernance validation
auditlog, query, verifyAudit trail queries

Key Features:

  • Append-only JSONL audit log
  • Command signature tracking (args, exit code, duration)
  • Agent-accessible via MCP
  • Full traceability for compliance

Dependencies: agileplus-domain, serde, chrono

Stability: Very stable. Commands are immutable once added.

agileplus-telemetry

Observability: logging, metrics, tracing.

TypePurpose
TraceLayerOpenTelemetry integration (optional)
MetricsCollectorPrometheus-compatible metrics
LogFormatterStructured logging with context

Dependencies: tracing, opentelemetry, prometheus

Stability: Very stable. Observability-only.

Agents (Separate Workspace)

The agileplus-agents/ directory contains AI agent orchestration.

agileplus-agent-dispatch

Agent dispatch and lifecycle management (WP08).

TypePurpose
AgentDispatchAdapterImplements AgentPort from domain
AgentTaskWork package + context + prompt
AgentConfigKind, timeout, review cycles
AgentResultExit code, commits, PR URL
JobStatePending, Running, Completed, Failed

Key Features:

  • Job ID tracking (UUID v4)
  • Async dispatch with background tracking
  • Status polling for long-running agents
  • Session timeout with graceful termination
  • Review loop integration

Dependencies: agileplus-domain, tokio, dashmap, uuid

Stability: Moderate. Agent orchestration is still evolving.

agileplus-agent-service

gRPC service for agent-facing APIs (WP09).

Key Services:

  • Agent registration
  • Prompt delivery
  • Output collection
  • Session lifecycle

Dependencies: agileplus-agent-dispatch, tonic, prost

Stability: Moderate.

agileplus-agent-review

Code review automation and fallback (WP09).

TypePurpose
CodeRabbitReviewerCodeRabbit bot integration
CiStatusPollingGitHub Actions CI status
FallbackReviewerSimple heuristic-based review

Key Features:

  • Wait for CodeRabbit reviews
  • Poll GitHub Actions status
  • Fallback to basic checks if CI/review unavailable

Dependencies: agileplus-domain, octocrab, reqwest, tokio

Stability: Moderate. Review logic may expand.

Dependency Graph

agileplus-domain (0 external deps)

  ├─ agileplus-cli
  ├─ agileplus-sqlite
  ├─ agileplus-git
  ├─ agileplus-api
  ├─ agileplus-grpc
  ├─ agileplus-triage
  ├─ agileplus-plane
  ├─ agileplus-github
  ├─ agileplus-subcmds
  ├─ agileplus-telemetry
  └─ agileplus-agents/*
        ├─ agileplus-agent-dispatch
        ├─ agileplus-agent-service
        └─ agileplus-agent-review

Key Principle: All arrows point UP to domain. No downward dependencies.

Compilation & Workspace

Build the full workspace:

bash
cargo build --release
cargo test
cargo test --all --doc

Build individual crates:

bash
cargo build -p agileplus-cli
cargo build -p agileplus-sqlite --release

Run CLI:

bash
cargo run -p agileplus-cli -- specify 001-login

Stability Matrix

CrateStabilityFrequencyImpact
agileplus-domainVery HighRareHigh (affects all)
agileplus-cliModerateRegularHigh
agileplus-sqliteVery HighRareHigh (data)
agileplus-gitVery HighRareMedium
agileplus-apiModerateRegularMedium (external)
agileplus-grpcModerateRegularMedium (external)
agileplus-githubModerateRegularMedium (integration)
agileplus-agents/*LowFrequentMedium (WIP)

MIT License