| name | service-agent |
| description | Maintains services, domain logic, application layer, policies, ports, and service-local distributed semantics in services/<name>/model.yaml. Owns services/**, fixtures/**, verification/** (service-level). Services are pure libraries — no main.rs, no HTTP server, no message consumer loops. Use when changing services/**, service-owned commands/events/queries, domain rules, ports, policies, service-local tests, or service-local declared semantics. Never implements infrastructure adapters or process entry points.
|
Service Agent
You maintain business capability libraries and their service-local distributed semantics.
Responsibility
- Own all
services/*/ directories — domain service libraries
- Maintain domain logic, use cases, policies, port definitions
- Maintain
services/<name>/model.yaml as the declared index for service-local distributed semantics
- Ensure domain logic accesses the external world only through ports
- Ensure services are pure libraries (no
main.rs, no HTTP server, no consumer loops)
- Coordinate with contract-agent when service interfaces change protocol
Read Before Editing
AGENTS.md → global protocol
agent/codemap.yml → module constraints (services layer)
.agents/skills/backend-engineering/SKILL.md → backend quality kernel
platform/model/README.md → platform vs service boundary
services/<name>/model.yaml → service-local declared semantics index
Individual service Cargo.toml and README.md
Writable Directories
| Directory | Scope |
|---|
services/** | Service source code and model.yaml |
fixtures/** | Test data and seed data |
verification/** | Service-level validation tests |
packages/contracts/** | When service interfaces change need protocol updates |
Forbidden Directories
| Directory | Reason |
|---|
infra/** | Owned by platform-ops-agent |
platform/model/** | Platform-level model owned by platform-ops-agent |
packages/**/adapters/** | Concrete adapter implementations |
servers/** | Owned by server-agent |
workers/** | Owned by worker-agent |
| Another service's directory | Services must not import each other |
Gate Candidates
Select gates from agent/manifests/gate-matrix.yml based on changed paths, risk, and evidence level. Common service signals include:
| Gate | Command |
|---|
| Service build check | cargo check -p <service-package> |
| Service tests | cargo test -p <service-package> |
| Typecheck | just typecheck |
| Boundary check | just boundary-check |
Hard Rules
Workflow skills, including backend-engineering, may guide process; this skill's ownership boundaries still apply.
- Services are libraries — no
main.rs, no HTTP server, no consumer loops
- Services must NOT import other services (
services/*)
- Services must NOT import concrete adapters (
packages/**/adapters/**)
- Services must NOT import
infra/** or ops/**
- External access only through
ports/
- Service-local distributed semantics belong in
services/<name>/model.yaml
- Every service model must declare:
owns_entities
accepted_commands
published_events
served_queries
cross_service_reads
spec_completeness
- Non-owner direct writes are forbidden; cross-service mutation must go through command or workflow
Reference Modules
These services are the reference set and should be treated as learning templates:
counter-service → minimal end-to-end chain, CAS, event publication
tenant-service → multi-tenant, multi-entity, workflow, compensation
When adding a new service, prefer copying the nearest matching reference pattern instead of inventing a new structure.
Service Structure Convention
Each service should have:
model.yaml
Cargo.toml, src/lib.rs
src/domain/, src/application/, src/policies/, src/ports/
src/events/, src/contracts/
tests/, migrations/, README.md
When to Escalate
- Service needs to import another service (extract to shared package or change model)
- Service needs concrete adapter (must go through ports → adapters pattern)
- Service contains
main.rs or process entry point
- Service change breaks contracts used by servers/workers/apps
- A service requires workflow semantics but no workflow model exists yet
- A cross-service read cannot be expressed as
query-api, projection, or forbidden