You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pyramids/change-flow/index.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,16 +6,16 @@ Defines the pyramid-first discipline: all changes to code must originate in pyra
6
6
7
7
## Concepts
8
8
9
-
-**Pyramid-first.** The path is always: describe the change conceptually (new or update), verify alignment (audit), then implement (implement or tighten). Code is never modified outside this flow.
10
-
-**Bootstrap exception.** When adopting pyrs on existing code or capturing manually-written code, bootstrap reverses the flow — it reads code and produces pyramids. Once bootstrap completes, the pyramid-first rule applies to all future changes.
9
+
-**Pyramid-first.** The path is always: describe the change conceptually (spec), verify alignment (sane), then apply the code (apply). Code is never modified outside this flow.
10
+
-**Ingest exception.** When capturing pyramids from existing code, ingest reverses the flow — it reads code and produces pyramids. Use it when adopting pyrs, when capturing manually-written code, or when re-ingesting code that has evolved.
11
11
-**Strict scoping.** Implementation is bounded by the target pyramid. An agent implementing a pyramid builds only what that pyramid describes. Dependencies that don't exist yet get placeholders, not implementations.
12
12
-**Provenance tracking.** Code and tests generated from pyramids carry provenance comments (`// PYRS: identifier`) so the connection between concept and code is traceable. Unbuilt dependencies get `// PYRS_TODO` placeholders with runtime logging.
13
13
-**Opt-out for code markers.** A pyramid (or any ancestor) can include a constraint prohibiting code markers. This opt-out is inherited by all descendants and causes provenance comments and placeholders to be omitted entirely.
14
-
-**The audit loop.** The feedback loop between pyramids and code: define or revise a concept, audit for hierarchy fit, implement or tighten the code, review for drift. This loop runs continuously across sessions.
14
+
-**The audit loop.** The feedback loop between pyramids and code: define or revise a concept (spec), check for hierarchy fit (sane), apply the code (apply), check for drift (diff). This loop runs continuously across sessions.
15
15
16
16
## Contracts
17
17
18
-
- All code changes flow through `implement` or `tighten` — these are the only routes from pyramid to code.
18
+
- All code changes flow through `apply` — this is the only route from pyramid to code.
19
19
- Implementation scope is strictly bounded by the target pyramid. No parent scope, no child scope, no undocumented extras.
20
20
- Unbuilt dependencies produce `PYRS_TODO` placeholders with meaningful runtime logging, unless the pyramid opts out of code markers.
21
21
- Code generated from a pyramid carries `PYRS: identifier` provenance comments, unless the pyramid opts out of code markers.
@@ -24,12 +24,12 @@ Defines the pyramid-first discipline: all changes to code must originate in pyra
24
24
25
25
## Relationships
26
26
27
-
- Parent: [Pyrs](./index.md)
28
-
- See Also: [Pyramid Model](./pyramid-model/index.md) — the change flow operates on the structures defined by the model
29
-
- See Also: [Commands](./commands/index.md) — commands are the mechanism through which the change flow is executed
27
+
- Parent: [Pyrs](../index.md)
28
+
- See Also: [Pyramid Model](../pyramid-model/index.md) — the change flow operates on the structures defined by the model
29
+
- See Also: [Commands](../commands/index.md) — commands are the mechanism through which the change flow is executed
30
30
31
31
## Constraints
32
32
33
-
- The change flow must not allow direct code modification outside of `implement` and `tighten`. Bootstrap does not modify code — it only reads code and produces pyramids.
33
+
- The change flow must not allow direct code modification outside of `apply`. Ingest does not modify code — it only reads code and produces pyramids.
34
34
- Placeholders must not silently degrade — they must produce visible runtime output so missing pieces are noticed, not ignored.
35
35
- The agent must never silently resolve ambiguity during any phase of the flow. Probing over assuming is non-negotiable.
Produce or update code from a pyramid using incremental test-driven development. Apply is the only route from concept to code — it handles both building from scratch and updating existing code to match a revised pyramid.
6
+
7
+
## Concepts
8
+
9
+
-**Syntax:**`::apply P` — P is an `@`-prefixed pyramid reference targeting the pyramid to implement or re-align code to. P may be identifier form (for example, `@auth.oauth` or `@root.auth.oauth`) or a direct pyramid `index.md` link (for example, `@./pyramids/auth/oauth/index.md`).
10
+
-**Building from scratch.** When no code exists for the pyramid, the agent reads the pyramid, detects the project's test framework, and works through red/green cycles incrementally — one contract at a time, never in batch.
11
+
-**Updating to match revisions.** When code already exists and the pyramid has been revised via ::spec, the agent compares the updated pyramid against existing code, identifies gaps, and tightens incrementally. Code the pyramid no longer describes is removed.
12
+
-**Strict TDD.** Write a failing test for a contract, make it pass, move to the next contract. Non-negotiable and step-by-step.
13
+
-**Strict scoping.** Only what the target pyramid describes. Not the parent's behavior, not the children's behavior, not helpful extras.
14
+
-**PYRS_TODO placeholders.** Unbuilt dependencies get `// PYRS_TODO: ./pyramids/[path]` placeholders with runtime logging rather than guessed implementations.
15
+
-**PYRS provenance comments.** Generated code carries comments linking back to the source pyramid, unless the pyramid opts out.
16
+
-**Post-apply diff reconciliation.** If the target pyramid has a sibling `diff.md`, apply runs a same-target diff pass after code updates so the report is either refreshed with remaining gaps or deleted when fully reconciled.
17
+
18
+
## Contracts
19
+
20
+
- Apply is the only command that produces or modifies code.
21
+
- Apply uses incremental TDD — one contract at a time, red then green, no batching.
22
+
- Implementation scope is strictly bounded by the target pyramid.
23
+
- Unbuilt dependencies produce PYRS_TODO placeholders with meaningful runtime logging, unless the pyramid opts out of code markers.
- When updating, code the pyramid no longer describes is removed.
26
+
- After apply mutates code for target P, if sibling `diff.md` exists for P before or after the mutation, apply must run a same-target diff pass before final output.
27
+
28
+
## Relationships
29
+
30
+
- Parent: [Code Output](../index.md)
31
+
- See Also: [Spec](../../pyramid-output/spec/index.md) — spec revises pyramids, apply updates code to match
32
+
- See Also: [Mend](../../pyramid-output/mend/index.md) — mend patches pyramids, then routes to apply for the code fix
33
+
34
+
## Constraints
35
+
36
+
- Apply must not modify pyramids. It consumes pyramids and produces code.
37
+
- The agent must not skip TDD or batch multiple contracts.
38
+
- Placeholders must not be replaced with guesses. Only a subsequent apply of the dependency's pyramid replaces a placeholder.
39
+
- Post-apply diff refresh must be limited to the target scope. Apply must not trigger broad diff sweeps unless the user explicitly requested that scope.
Commands that produce or update code from pyramids. This is the only route from concept to code in the system, using incremental test-driven development to ensure code matches contracts.
6
+
7
+
## Concepts
8
+
9
+
-**Apply** is the single command that produces and modifies code. It handles both building a pyramid's concept from scratch and updating existing code to conform to a revised pyramid.
10
+
-**Test-driven development.** Apply follows strict TDD: write a failing test for a contract, make it pass, move to the next contract. This is non-negotiable and step-by-step — the agent does not batch multiple contracts into one implementation pass.
11
+
-**Strict scoping.** The agent implements only what the target pyramid describes. Not the parent's behavior. Not the children's behavior. Not helpful extras. Scope discipline is what makes the pyramid system trustworthy.
12
+
-**Placeholders for unbuilt dependencies.** When a child or See Also reference hasn't been implemented, the agent leaves a `// PYRS_TODO: ./pyramids/[path]` placeholder with runtime logging rather than guessing at the dependency's behavior.
13
+
-**Post-apply diff refresh.** When the target pyramid already has a sibling `diff.md`, apply runs a same-target diff pass after code changes so the report is immediately updated or removed.
14
+
15
+
## Contracts
16
+
17
+
- Apply is the only command that produces or modifies code.
18
+
- Apply uses incremental TDD — one contract at a time, red then green, no batching.
19
+
- Implementation scope is strictly bounded by the target pyramid. No parent scope, no child scope, no undocumented behavior.
20
+
- Unbuilt dependencies produce PYRS_TODO placeholders with meaningful runtime logging, unless the pyramid opts out of code markers.
21
+
- Generated code carries PYRS provenance comments linking back to the source pyramid, unless opted out.
22
+
- After apply mutates code for target P, if sibling `diff.md` exists for P before or after the mutation, apply runs a same-target diff pass before final output.
23
+
24
+
## Relationships
25
+
26
+
- Parent: [Commands](../index.md)
27
+
- Children:
28
+
-[Apply](./apply/index.md) — produce or update code from pyramids
29
+
- See Also: [Change Flow](../../change-flow/index.md) — apply is the code-producing step of the change flow
30
+
31
+
## Constraints
32
+
33
+
- Code output commands must not modify pyramids. They consume pyramids and produce code.
34
+
- The agent must not skip TDD or batch multiple contracts. The incremental discipline is what ensures each contract is independently verified.
35
+
- Placeholders must not be replaced with guesses. Only a subsequent apply of the dependency's pyramid replaces a placeholder.
36
+
- Post-apply diff refresh must stay target-scoped. Code output commands must not run broad multi-target diff sweeps unless the user explicitly requested that scope.
0 commit comments