Interview-driven constraint discovery across 5 categories.
Discipline: This command follows references/execution-discipline.md — the Iron Law of verification, the never-start-on-main rule, and the Red Flags below.
Scope Guard
This phase ONLY updates .manifold/<feature>.json and .manifold/<feature>.md. Do NOT create source files, spawn agents, or do work belonging to later phases. User answers are constraint INPUTS, not build instructions.
Markdown (.manifold/<feature>.md): Categories use ###, constraints use ####. JSON ID links to heading.
### Business#### B1: No Duplicate Payments
Payment processing must never create duplicate charges.
> **Rationale:** Duplicates cause chargebacks and customer complaints.
v3 Schema Compliance
Append an iteration entry when updating constraints. Required fields: number, phase, timestamp, result (string).
{"number":1,"phase":"constrain","timestamp":"2026-04-04T00:00:00Z","result":"Discovered 15 constraints across 5 categories","constraints_added":15,"by_category":{"business":3,"technical":4,"user_experience":3,"security":3,"operational":2}}
Non-Software Domain (when domain: non-software in manifold JSON)
Universal Category
Replaces
Core Question
Obligations
Business + Security
What must/must-not be true?
Desires
UX + Business goals
What does success look like?
Resources
Technical
What can I bring to this? Hard limits?
Risks
Security (broadened)
What could break irreversibly?
Dependencies
Operational
What external factors must hold?
JSON keys stay standard (business=Obligations, technical=Resources, user_experience=Desires, security=Risks, operational=Dependencies). Constraint types unchanged; only categories change. Use universal vocabulary (no software jargon) in interviews.
Constraint Types
INVARIANT - Must NEVER be violated (e.g., "No duplicate payments")
GOAL - Should be optimized (e.g., "95% success rate")
BOUNDARY - Hard limits (e.g., "Retry window ≤ 72 hours")
Interview Process
For each category, ask probing questions:
Business
What's the revenue/cost impact of this feature?
Are there compliance or legal requirements?
Who are the stakeholders and what do they need?
What happens if this feature fails?
Technical
What are the performance requirements?
What systems does this integrate with?
What data consistency guarantees are needed?
What's the expected load/scale?
Core Data Path Analysis (GAP-03): Identify the primary data flow through the system. For each transition in the flow, ask:
Does this transition cross a system boundary (process, network, service)?
What integration test constraint should cover this transition?
What is the fallback path if this transition fails?
User Experience
What response times are acceptable?
How should errors be communicated?
Are there accessibility requirements?
What's the user's mental model?
Security
What data needs protection?
What authentication/authorization is required?
What needs to be audited?
What are the threat vectors?
Resource Exhaustion Checklist (GAP-10): For each unauthenticated endpoint or path:
Can unauthenticated requests cause unbounded resource consumption?
Are there rate limits, negative caching, or input size bounds?
External Dependency Resilience (GAP-11): For each external HTTP dependency:
Is there a configurable timeout?
Is there a circuit breaker or fallback?
Is the response cached? What invalidation strategy?
Does failure isolate to just this dependency?
Crypto/Auth Attack Surface (GAP-09): For constraints involving crypto or authentication:
What attack test matrix should be generated? (algorithm confusion, timing, replay, forged signatures)
Are IP-based checks tested across IPv4, IPv6, and IPv4-mapped IPv6?
Operational
What needs monitoring?
What are the SLA requirements?
What's the incident response process?
How will this be deployed/rolled back?
Input Validation Derivation (GAP-14)
When constraints reference data formats (e.g., "accept any JSON", "valid email"), auto-generate input validation sub-constraints:
Content-Type checking
Encoding validation
Schema validation at boundaries
These are placed in the suggested_constraints staging area in the manifold JSON. They don't count toward constraint totals until explicitly promoted by the user.
Concurrency Considerations (GAP-17)
When constraints involve shared state (caching, connection pools, singletons):
Are there thread-safety requirements?
Should concurrent request handling tests be generated?
What shared-state constraints exist?
GAP Checklist Compliance (MANDATORY)
After all five interviews, each GAP MUST be COMPLETED or SKIPPED (with reason). Record in JSON "gap_checklist_compliance":
/manifold:m1-constrain payment-retry
CONSTRAINT DISCOVERY: payment-retry
Business: B1 No duplicate payments (INVARIANT), B2 95% success rate (GOAL), B3 Retry ≤72h (BOUNDARY)
Technical: T1 API <200ms (BOUNDARY), T2 10K concurrent retries (GOAL)
UX: U1 Clear retry status (GOAL), U2 No user action for auto-retries (INVARIANT)
Security: S1 No card numbers in logs (INVARIANT), S2 All retries audited (INVARIANT)
Operational: O1 Queue depth monitored (GOAL), O2 Alert on <90% success (BOUNDARY)
Updated: .manifold/payment-retry.json + .manifold/payment-retry.md (11 constraints)
Next: /manifold:m2-tension payment-retry
Context Lookup
Before interviewing, use WebSearch to research the feature domain (best practices, API changes, compliance). Summarize as "DOMAIN CONTEXT" block before starting. Skip if --skip-lookup flag or purely internal feature.
Execution Instructions
Run Context Lookup (WebSearch) unless --skip-lookup
Investigate the codebase before asking. When a constraint question can be answered by reading the repo (e.g., "what's the current rate-limit?", "which auth scheme is in use?", "is there an existing retry policy?"), use Read/Grep/Glob — and any available MCP tools that surface code structure or relationships — before asking the user. Surface findings as REPO CONTEXT alongside the WebSearch DOMAIN CONTEXT block. Only ask the user about facts the code cannot answer.
Read .manifold/<feature>.json and .manifold/<feature>.md
If --category specified, focus on that category only
Run GAP checklists, pre-mortem, quality check, draft required truths
Update both files: JSON (IDs + types) and MD (statements + rationale)
Set phase to CONSTRAINED, append iteration, run manifold validate <feature>
Display summary and suggest next step
User Interaction (MANDATORY)
This phase is interview-driven. Many moments call for user input — choosing which category to constrain first, picking between alternative phrasings of a constraint, confirming pre-mortem stories, resolving ambiguous constraint genealogy. Every such moment MUST go through AskUserQuestion (or the agent-equivalent: numbered options for Gemini, labelled choices for Codex).
If your reply contains a question soliciting a user response → use AskUserQuestion.
Markdown options/tables/bulleted lists ending in "which one?" or "your call" are the anti-pattern this rule prevents.
Exceptions: rhetorical phrasing, or "I will assume X — say so if not" assumption call-outs.
Read-only summaries at the end of the phase do NOT need AskUserQuestion — end with the suggested next command.
For each question, flag your recommended answer with rationale. AskUserQuestion options should not be presented as a flat menu — name which option you would pick and why (in the question prose, not by re-ordering or hiding options). The user is then confirming or rejecting a position rather than choosing blind. The user can always override; the recommendation reduces cognitive load and prevents the "ten weak options" anti-pattern.
See install/agents/interaction-rules.md for the canonical contract; the prompt-enforcer.ts hook injects the same rules at runtime as defence-in-depth.
Red Flags
Thought
Reality
"I'll list the constraints I assume"
Constraints are discovered by interview and codebase investigation, not invented.
"One big question covers it"
One question at a time; investigate the codebase before asking.
"Every category must be filled"
An empty category is a valid finding, not a gap to pad.
Run manifold validate <feature> after updates. Shared directives (output format, interaction rules, validation) injected by phase-commons hook.