agentleFS
terrene-foundationterrene-foundation/pact/CLAUDE.md

pact

CLAUDE.md0 starsChanged 7 months agoApache-2.0View on GitHub

This repository is PACT — the Terrene Foundation's reference implementation of PACT (Principled Architecture for Constrained Trust), the fourth standard in the Quartet alongside CARE, EATP, and CO. It implements the D/T/R accountability grammar, recursive operating envelope delegation, knowledge clearance framework, and verification gradient for running organizations with AI agents under governed autonomy. PACT is Foundation-owned, Apache 2.0 licensed, and irrevocably open. Since the standards, SDKs, and reference model are all open, anyone can build commercial implementations on top —…

  • Reads credentials

The file

We split this CLAUDE.md into the rules it gives an agent

10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 5

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    The boundary test: If you ripped out all domain vocabulary from a vertical's code and replaced it with different domain terms, the pact …

    line 11
  2. Distinctive:

    Never write code from scratch before checking whether the Kailash frameworks already handle it.

    line 35
  3. Very specific:

    Instead of direct SQL/SQLAlchemy/Django ORM → check with dataflow-specialist

    line 37
  4. Distinctive:

    Instead of FastAPI/custom API gateway → check with nexus-specialist

    line 38
  5. Distinctive:

    Instead of custom MCP server/client → check with mcp-specialist

    line 39
  6. Distinctive:

    Instead of custom agentic platform → check with kaizen-specialist

    line 40
  7. Very specific:

    All API keys and model names MUST come from .env.

    line 44
  8. Distinctive:

    When you discover a missing feature, endpoint, or record — implement or create it.

    line 50
  9. Very specific:

    Every implementation decision must align with the CARE, PACT, EATP, and CO specifications.

    line 56
  10. Very specific:

    Session continuity: Run /wrapup before ending a session to write .session-notes.

    line 128

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

PACT

This repository is PACT — the Terrene Foundation's reference implementation of PACT (Principled Architecture for Constrained Trust), the fourth standard in the Quartet alongside CARE, EATP, and CO. It implements the D/T/R accountability grammar, recursive operating envelope delegation, knowledge clearance framework, and verification gradient for running organizations with AI agents under governed autonomy.

PACT is Foundation-owned, Apache 2.0 licensed, and irrevocably open. Since the standards, SDKs, and reference model are all open, anyone can build commercial implementations on top — the Foundation has no structural relationship with any commercial entity.

What This Is

A framework and reference implementation of PACT (Principled Architecture for Constrained Trust). PACT publishes the domain-agnostic governance framework — D/T/R grammar validation, operating envelope composition, knowledge clearance, verification gradient — plus a simple example vertical (e.g., a university or open-source project) that proves the system works without requiring domain expertise. Built on the Kailash Python SDK (Kaizen agent framework, DataFlow persistence, Nexus API layer, EATP SDK trust layer).

The boundary test: If you ripped out all domain vocabulary from a vertical's code and replaced it with different domain terms, the pact library code wouldn't change at all. Only the configuration and domain layer would change.

What it is NOT: A generic agent orchestrator competing with LangChain/CrewAI. It is governed orchestration — an opinionated framework for running organizations with AI agents under PACT architectural governance.

Framework vs Verticals

LayerRepositoryPurpose
Frameworkpact (this repo)Domain-agnostic PACT library + example vertical
Financial verticalastraProduction-grade MAS-regulated financial services
HRIS verticalarborProduction-grade Singapore SME HR governance

Verticals import pact and define their domain's D/T/R structure, envelope constraints, and clearance mappings as PACT configuration. The framework knows nothing about finance, healthcare, or any other domain.

Absolute Directives

These override ALL other instructions. They govern behavior before any rule file is consulted.

0. Foundation Independence — No Commercial Coupling

PACT is a Terrene Foundation project. It is fully independent. There is NO relationship between PACT and any commercial product, proprietary codebase, or commercial entity. Do not reference, compare with, or design against any proprietary product. Do not use language like "open-source version of X." PACT IS the product — not a derivative of anything. See rules/independence.md for full policy.

1. Framework-First

Never write code from scratch before checking whether the Kailash frameworks already handle it.

  • Instead of direct SQL/SQLAlchemy/Django ORM → check with dataflow-specialist
  • Instead of FastAPI/custom API gateway → check with nexus-specialist
  • Instead of custom MCP server/client → check with mcp-specialist
  • Instead of custom agentic platform → check with kaizen-specialist

2. .env Is the Single Source of Truth

All API keys and model names MUST come from .env. Never hardcode model strings like "gpt-4" or "claude-3-opus". Root conftest.py auto-loads .env for pytest.

See rules/env-models.md for full details.

3. Implement, Don't Document

When you discover a missing feature, endpoint, or record — implement or create it. Do not note it as a gap and move on. The only acceptable skip is explicit user instruction.

See rules/zero-tolerance.md for details.

4. Standards Alignment

Every implementation decision must align with the CARE, PACT, EATP, and CO specifications. When in doubt, consult the relevant standards expert agent. This repo is the reference implementation of the Quartet — it must embody them correctly.

5. Recommended Reviews

  • Code review (intermediate-reviewer) after file changes — see rules/agents.md Rule 1
  • Security review (security-reviewer) before commits — strongly encouraged — see rules/agents.md Rule 2
  • Real infrastructure in integration/E2E tests is recommended — see rules/testing.md

Architecture Overview

Three-Layer Stack

LayerPackageWhatVersion
L3pact-platform (this repo)Org builder, approval UX, work management, dashboard, deployment0.3.0
L2kaizen-agentsGovernedSupervisor, progressive disclosure, autonomous execution0.1.0
L1kailash-pactGovernanceEngine, D/T/R grammar, envelopes, clearance, gradient0.3.0
L1kailash[trust]EATP SDK, trust chains, signing, postures, enforcement2.0.0+
L1kailash-dataflowAuto-generated CRUD nodes (11 per model)1.2.0
L0kailashCore SDK, workflow runtime, 140+ nodes2.0.0+

Platform Components (v0.3.0)

ComponentLocationWhat
DataFlow Models (11)pact_platform/models/AgenticObjective, Request, WorkSession, Artifact, Decision, ReviewDecision, Finding, Pool, PoolMembership, Run, ExecutionMetric
API Routers (13)pact_platform/use/api/routers/objectives, requests, sessions, decisions, pools, reviews, metrics, org, clearance, ksp, envelopes, access, emergency-bypass
Services (5)pact_platform/use/services/RequestRouter, ApprovalQueue, CompletionWorkflow, CostTracking, NotificationDispatch
Engine (6)pact_platform/engine/SupervisorOrchestrator, ApprovalBridge, EventBridge, EmergencyBypass, PlatformSettings, AutoSeed
Integrations (6)pact_platform/integrations/NotificationAdapter, Slack/Discord/Teams webhooks, LLMProviderManager
CLI (10 commands)pact_platform/cli.pyquickstart, org, role, clearance, bridge, envelope, agent, audit, validate, status
Web Dashboard (4 new)apps/web/app/objectives, requests, pools, org-builder pages
Mobile Screens (3 new)apps/mobile/lib/features/objectives, requests, pools screens
Existing Frontendapps/web/, apps/mobile/approvals, agents, bridges, trust-chains, envelopes, cost, audit, shadow, verification

Import Patterns

# Governance (from kailash-pact — L1)
from pact.governance import GovernanceEngine, GovernanceVerdict
from pact.governance import compile_org, load_org_yaml

# Config types (from this repo — L3)
from pact_platform.build.config.schema import OrgDefinition, AgentConfig, ConstraintEnvelopeConfig

# Work management models (from this repo — L3)
from pact_platform.models import db, validate_finite

# Engine wiring (from this repo — L3)
from pact_platform.engine import SupervisorOrchestrator, EmergencyBypass

# Trust layer (kailash[trust] — L1)
from kailash.trust import TrustOperations, generate_keypair
from kailash.trust.chain import VerificationLevel, VerificationResult

Workspace Commands

CommandPhasePurpose
/start—New user orientation; explains the workflow
/analyze01Research and validate the project idea
/todos02Create project roadmap; stops for your approval
/implement03Build one task at a time; repeat
/redteam04Test from adversarial angles
/codify05Capture knowledge for future sessions
/deploy—Get the project live (standalone)
/ws—Check project status anytime
/wrapup—Save progress before ending a session

Workspace detection: Hooks automatically detect the active workspace and inject context.

Session continuity: Run /wrapup before ending a session to write .session-notes. The next session reads these notes automatically.

Rules Index

ConcernRule FileScope
Foundation independencerules/independence.mdGlobal — overrides all
Plain-language communicationrules/communication.mdGlobal
Agent orchestration & reviewsrules/agents.mdGlobal
E2E god-mode testingrules/e2e-god-mode.mdtests/e2e/**, **/*e2e*, **/*playwright*
API keys & model namesrules/env-models.md**/*.py, **/*.ts, **/*.js, .env*
Deployment operationsrules/deployment.mdGlobal
Git commits, branches, PRsrules/git.mdGlobal
No stubs or placeholdersrules/zero-tolerance.mdGlobal
Kailash SDK execution patternsrules/patterns.md**/*.py, **/*.ts, **/*.js
Security (secrets, injection)rules/security.mdGlobal
3-tier testing strategyrules/testing.mdtests/**, **/*test*, **/*spec*, conftest.py
Terrene naming & terminologyrules/terrene-naming.mdGlobal
Documentation & version accuracyrules/documentation.mdREADME.md, docs/**, CHANGELOG.md
Auto-generated workflow instinctsrules/learned-instincts.mdGlobal

Agents

Agents are organized by function. See .claude/agents/ for the full set.

CategoryKey Agents
Analysisanalyst (failure analysis + requirements)
Frameworksdataflow-specialist, nexus-specialist, kaizen-specialist, mcp-specialist, pact-specialist
Qualityreviewer, security-reviewer, gold-standards-validator, testing-specialist
Implementationtdd-implementer, pattern-expert, build-fix
Frontendreact-specialist, flutter-specialist, uiux-designer
Releaserelease-specialist, todo-manager, gh-manager
Projectpact-dashboard-specialist, pact-trust-specialist

Standards reference: use co-reference skill (covers CARE, EATP, CO, COC specs).

Skills

SDK skills in .claude/skills/01-* through 17-*. Standards in co-reference/, 26-eatp-reference/, 29-pact/. Project skills in project/.

Critical Execution Rules

# ALWAYS: runtime.execute(workflow.build())
runtime = LocalRuntime()
results, run_id = runtime.execute(workflow.build())

# Async: await runtime.execute_workflow_async(workflow.build(), inputs={})
# Express CRUD: db.express_sync.create("Model", {...})  # 23x faster than workflows
# PactEngine: result = await pact_engine.submit(objective, role, context)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.