Form

From nrdxp/predicate · View interactive version

Form is an AI agent skill from the GitHub repository nrdxp/predicate. SOP for formal mathematical domain modeling. Trigger when: - Creating new formal models or applying mathematical lenses to analyze existing specifications. - Navigating phases: Identify, Select, Construct, Validate, Record, Connect. - Prompt contains: /form, form workflow, categorical, coalgebraic,

How to use this skill

Skill file

FORM Protocol v2.0 (Control-Theoretic Modeling)

Identify → Select → Construct → Validate → Record → Connect

This workflow defines the C.O.R.E. Modeling phase. The objective is to define the formal structural representation of a domain, establishing the state space, transition relationships, and coalgebraic dynamics. This serves as the structural foundation from which normative constraints and test invariants are derived.


Philosophy

Formal models are the bridge between empirical observations and proof. An olog, a coalgebra, a session type specification — each makes implicit relationships explicit and mathematically verifiable. Without formal models, sequence trajectories are guided by anthropomorphic verbal descriptions that cannot be checked or formally composed.

FORM provides the procedure for constructing these structural representations. The sdma skill defines a foundational toolkit of categorical, coalgebraic, and information-theoretic isomorphisms. The principle of minimal representation governs selection: choose the simplest mathematical formalism that faithfully captures the domain's structure, and use it to map the state space for subsequent verification loops.


Scope

[!IMPORTANT]

FORM produces formal model documents — either creating new ones from templates/MODEL.md or scrutinizing existing documents (protocol specs, whitepapers, design docs) through the SDMA lens. It is structural analysis, not planning, exploration, or implementation: strategic planning and exploration are the standing Planning Invariants and Sketch Principle, and implementation is /core. If you find yourself writing code or redesigning architecture, you've left FORM territory.


Dual-Mode Operation

MODEL operates in two modes, determined by context:

Create Mode

Trigger: No existing document specified. The human requests a formal model for a domain or problem.

Flow: Produce a new model document from templates/MODEL.md, committed to docs/models/.

Output: A complete model document with all five template sections filled.

Apply Mode

Trigger: An existing document is specified (protocol spec, whitepaper, design doc, etc.).

Flow: Scrutinize the existing document through the SDMA lens. Identify which formalisms apply, what structure is implicit, where rigor is missing, and what the formal model reveals.

Output: Either annotations/refinements to the existing document, or a companion model document in docs/models/ that formalizes the document's domain.

[!NOTE]

In Apply mode, the target document may not need all SDMA formalisms. The Decision Matrix (SDMA §6) determines which tools are relevant. Don't force a formalism where none is warranted.


Grammar

# 1. STATE METADATA
STATUS: [IDENTIFY | SELECT | CONSTRUCT | VALIDATE | RECORD | CONNECT]

# 2. CONTEXT
CTX:
  MODE: [CREATE | APPLY]
  DOMAIN: "Problem domain being modeled"
  TARGET: "path/to/existing/doc.md" # Apply mode only
  SCOPE: "What aspect of the domain to model"

# 3. FORMALISM SELECTION (populated in SELECT)
FORMALISM:
  PRIMARY: "Selected representation (from Decision Matrix)"
  SUPPORTING: ["Additional formalisms if layered"]
  RATIONALE: "Why this formalism fits the domain"

# 4. MODEL (populated in CONSTRUCT)
MODEL:
  TYPE: "Olog | Coalgebra | Session Type | LinRel | Hyperdoctrine | ..."
  COMPONENTS: ["Key structural elements of the model"]

# 5. VALIDATION (populated in VALIDATE)
VALIDATION:
  CHECKS:
    - CHECK: "What was verified"
      RESULT: [PASS | FAIL | PARTIAL]
      DETAIL: "Specifics"

Procedure

Step 1: IDENTIFY

Characterize the problem domain and determine what needs formal modeling.

Create mode:

Apply mode:

Step 2: SELECT

Choose the appropriate formalism(s), starting from the Decision Matrix (SDMA §6) but not constrained by it.

Both modes:

[!IMPORTANT]

HALT after SELECT. Present the formalism selection and rationale to the human before constructing the model. Wrong formalism choice cascades into wasted work.

Step 3: CONSTRUCT

Build the formal model.

Create mode:

Apply mode:

Step 4: VALIDATE

Verify the model's internal consistency, external adequacy, and framing assumptions.

Document all validation checks and their results.

Step 5: RECORD

Commit the model as a durable artifact.

Create mode:

Apply mode:

[!IMPORTANT]

Template discipline. Create mode documents MUST use templates/MODEL.md. Ad hoc formats are a protocol violation. Apply mode companion documents also use the template; integrated annotations follow the target document's format.

Step 6: CONNECT (State Transition Verification Mapping)

Link the formal model to the verification pipeline:


State Transitions

IDENTIFY ──→ SELECT     (domain understood, characteristics identified)
         └─→ ABORT      (domain not suitable for formal modeling)

SELECT ──→ CONSTRUCT    (formalism chosen, human approved)
       └─→ IDENTIFY     (wrong scope — need to reframe)

CONSTRUCT ──→ VALIDATE  (model built)
          └─→ SELECT    (formalism doesn't fit — need different tool)

VALIDATE ──→ RECORD     (model passes validation)
         └─→ CONSTRUCT  (validation failures require model revision)

RECORD ──→ CONNECT      (artifact committed)

CONNECT ──→ DONE        (context linked, implications noted)

MANDATORY HALT Points

You MUST stop and await human input at:

  1. After SELECT: Formalism choice must be approved before construction
  2. After VALIDATE (if failures): Human decides whether to revise or accept partial model
  3. Before RECORD (Apply mode): Human chooses companion document vs. integrated annotations

Model Storage

docs/
└── models/
    └── <domain-name>.md    # formal model artifact

Model filenames should be descriptive of the domain being modeled, not the formalism used. Example: docs/models/payment-protocol.md, not docs/models/session-type-1.md.


Integration with Sketch Lifecycle

If a sketch exists for the current workstream:

The sketch captures the _modeling journey_; the model document captures the _outcome_.


Position in the Workflow Chain

FORM is a domain-specific structural-analysis tool, not a pipeline stage:

explore (ambient Sketch Principle)  →  understand the problem space
                                        ↓
/form    →  formalize domain understanding (can be invoked from any phase)
         ↓
/spec    →  declare normative constraints over the model (→ what MUST hold)
         ↓
/core    →  regulate state (guided by model, constrained by spec)

FORM can be invoked standalone or from within any other workflow. A model produced while exploring informs the strategy that follows; a model produced during /core validates implementation decisions. The formal model is a structural analysis tool available at any point. Strategy itself is governed by the ambient Planning Invariants, not a discrete planning workflow.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.