Auth drift
Roles and scopes change between sessions. No single source of truth for who may call what.
You write what must stay true.
AI writes how it works.
Write intent.
Compile contracts.
Verify implementations.
pactia 1.0
import { @api, @auth, #list, #paginated, #owner } from @pactia/kernel;
import { #rust-stack } from @pactia/rust-stack;
product Fleet {
> Vehicle rental platform. Customers book trips; fleet owners manage vehicles.
> Bearer JWT. Customers see only their bookings — admins see the full fleet.
> Cursor pagination on list endpoints (default 20, max 100).
context agent_rules {
path: "./context/agent-rules.md",
> Never invent routes or roles not declared in this file.
}
#rust-stack
#list
#paginated
@auth { roles: [Customer, Admin] }
#owner
@api list_bookings {
method: GET,
path: "/api/v1/bookings",
> Returns the caller's bookings only — no cross-tenant reads.
}
}
> problem
Every AI coding session starts cold. Agents re-read scattered READMEs, stale OpenAPI, old ADRs, and Slack threads — then guess. Auth drifts. Pagination diverges. Event shapes disagree. Senior engineers fix what the model invented instead of shaping what matters.
Roles and scopes change between sessions. No single source of truth for who may call what.
Pagination, error envelopes, and response shapes diverge across services and agents.
Producers and consumers argue from different documents — or none at all.
Engineers spend sprints undoing what the model guessed instead of enforcing what matters.
> packages
Chat prompts die in history. Pactia packages let you pin and reuse intent the way Go modules pin code — prose, tags, macros, and attached context together in every repo and agent session.
import @scope/name
Pull in kernel tags, stack macros, compliance rules, or your org’s standards.
context { path: "…" }
Attach and share markdown specs, agent rules, and schemas — versioned beside your product and reusable across packages.
pactia.toml + pactia.lock
Reproducible installs from git tags — same coordinates in every workspace.
Prose · tags · macros · context
One package can ship agent policy, API patterns, platform defaults, and context files — not copy-paste between repos.
Like Rust has cargo and crates.io, Pactia has pactia and pactia.io. Read more in the overview · packages spec
> intent_line
Above the line: what every session must inherit — regardless of model, engineer, or sprint. Below the line: how it works today. Pactia never owns it.
Entities, APIs, roles, policy, stack law, prose, tags, packages, and provenance. Deterministic. Enforceable when tagged.
Logic, indexes, edge cases, tuning, and copy. Owned by engineers and AI — free, but checked against the contract.
> example
Natural language is not a comment to discard — it is first-class input. Same language, same pipeline, graded precision from agent rules to full spec.
pactia 1.0
import @pactia/kernel;
import @pactia/rust-stack;
product FleetManagement {
> Track vehicles and fleets. Customers see only their own vehicles.
context fleet_audit_policy {
path: "./context/fleet/audit-policy.md",
}
#rust-stack
@topology { mode: microservices, }
@guide {
> Map API errors to the platform envelope
> Cursor pagination on every list — never offset
> ${fleet_audit_policy} Required for admin mutation endpoints.
}
module fleet {
@actor admins { role: Admin, capabilities: [manage_fleets], }
@actor customers { role: Customer, capabilities: [track_vehicles], }
@rule admin_only_register {
> Only admins may register or decommission vehicles.
}
model {
@enum VehicleStatus { values: [ACTIVE, INACTIVE, DECOMMISSIONED], }
@entity Customer {
@@pk
id: uuid,
name: string,
email: string,
}
@entity Vehicle {
@@pk
id: uuid,
customerId: uuid,
vin: string,
label: string,
status: VehicleStatus,
}
@entity CreateVehicleRequest {
customerId: uuid,
vin: string,
label: string,
}
@entity VehicleListResponse {
vehicles: Vehicle[],
@@nullable
nextCursor: string,
}
@entity CreateVehicleResponse {
vehicleId: uuid,
vin: string,
}
}
@security fleet { > All admin mutations must be audit-logged }
service FleetService {
#database
> Fleet tracking API
@auth { roles: [Customer, Admin] }
#list
@@output VehicleListResponse
@api list_vehicles {
method: GET,
path: "/api/v1/vehicles",
}
@auth { roles: [Admin] }
#create
@@output CreateVehicleResponse
@api create_vehicle {
method: POST,
path: "/api/v1/vehicles",
}
@test admin_registers_vehicle {
name: "Admin registers a vehicle",
when: "Admin is logged in and POST /api/v1/vehicles with valid body",
then: "status is 201",
}
}
}
}
Altitude 1+
Tagged — structure where it helps
@actor, @entity, @api — enforceable roles, models, and routes.
View fixture ↗pactia 1.0
import @pactia/rust-stack;
product FleetManagement {
> Platform for tracking vehicles and managing fleets.
> Trust is the core product value — customers must only ever see their own vehicles.
> Every action that touches fleet data must be auditable.
> Map all API errors to the platform envelope before returning to clients.
> Use cursor pagination on every list endpoint — never offset.
context fleet_audit_policy {
path: "./context/fleet/audit-policy.md",
}
@rule admin_audit_logged {
> ${fleet_audit_policy} Required for admin mutation endpoints.
}
#rust-stack
module fleet {
> Admins manage fleets, register vehicles, and decommission vehicles.
> Customers browse and track vehicles assigned to their account.
> Only admins may register or decommission a vehicle.
> All admin mutations must be audit-logged.
> A vehicle belongs to exactly one customer.
> VIN must be unique across the platform.
> GPS position history is retained indefinitely for audit and dispute resolution.
> Customers and admins can list vehicles.
> Results are owner-scoped for customers and show the full fleet for admins.
> Lists are cursor-paginated with a stable sort by creation time.
> Only admins may create a vehicle.
> Creating a vehicle requires a valid customer, VIN, label, and device binding.
> A vehicle.created notification is emitted when registration succeeds.
> Customers who attempt to register a vehicle receive forbidden — not found masking.
> Duplicate VIN registration returns conflict with a clear error code.
}
}
Altitude 0
Prose — fully legal, no tags
Same story in > lines — guidance-first until you add tags.
View fixture ↗> features
The prompt is not the package. Chat history dies. import @pactia/kernel pins the same intent in every repo, session, and agent.
Cursor, Claude Code, Copilot, or custom agents — same .pactia, same lockfile, same IR.
Prose-only agent rules, mid-altitude APIs, or regulated depth. One compiler, one output path.
@pactia/rust-stack, @pactia/kernel, vertical libs. Digest-pinned lockfiles. Users fork packages, not the language.
No LLM in pactiac. Facts lower to JSON with provenance — byte-for-byte reproducible builds.
Backend, web, mobile in one workspace. @surface and @bind keep UI intent linked to APIs.
Durable .pactia files — not disposable chat. Permanent context per module and service.
> open_source
Open source. MIT licensed. Spec, compiler, package manager, and editor — each repo owns one layer of the toolchain.
> get_started
In one sentence: the durable, versioned layer between human intent and AI implementation.
# Package manager + compiler
curl -fsSL https://raw.githubusercontent.com/pactia-lang/pactia/main/scripts/install-pactia.sh | bash
pactia init my-product --name MyProduct
pactia add @pactia/rust-stack ^1.0
pactia build -C my-product