Skip to content

Commit 9c65c5f

Browse files
committed
Adapter purity permits declared code and execution placement (D-052)
Supersedes D-026's universal ban on adapter placement and rung-walking. Adapters are where program code meets the LM; formats can carry executable code. Purity means declared transformations without hidden LM calls or effects, not absence of code or placement. Executable entries declare code identity, dependencies, language, execution requirements, and placement needs; hosts supply compatible bindings or refuse loudly; the typed transformation interface stays invariant across local, sandboxed, and remote placement. Preserved: single-shot (PIR-008), credential names never values (PIR-005), identity vs location (PIR-010), receiver binding before sidecar, isolation floors, and the data-only declared-tier profile (DT-002/DT-003). No schema, fixture, or executor change; the byte shape and binding ABI are follow-up gates named in the changes entry. Touches spec/placement.md, spec/invariants.md (PIR-012), spec/errors.md (LANG/PROFILE), spec/manifest.md (component 4); changes/2026-09-07-adapter-code-placement.md records authority, scope, and gates. Source sync: dspy roadmap D-052.
1 parent 1a1be84 commit 9c65c5f

5 files changed

Lines changed: 151 additions & 5 deletions

File tree

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Adapter purity permits declared code and execution placement
2+
3+
**Recorded:** 2026-09-07. This is the amendment record date, not a separately
4+
verified approval date.
5+
6+
**Authority:** Maxime ratified the principle below in session on 2026-09-07,
7+
while designing LMCC's host-supplied format executor: amend ProgramIR rather
8+
than design LMCC around its old restriction. The ratification covers the
9+
principle, not a specific ABI or backend.
10+
11+
**Evidence type:** normative design amendment; no structural or execution
12+
fixtures change. `AUTHORITY.md` precedence and fixture evidence rules remain
13+
unchanged. Source record: DSPy `roadmap/05-decisions.md`, D-052.
14+
15+
## Reason and exact scope
16+
17+
D-026 treated purity as a universal ban on adapter placement. It also said
18+
execution placement could never be an artifact requirement. That restriction
19+
confused a declared transformation with a code-free representation.
20+
21+
Adapters are where program code meets the LM. Formats can carry executable
22+
code. Purity means declared transformations without hidden LM calls or effects.
23+
Artifacts must declare code identity, dependencies, language, execution
24+
requirements, and enough placement information to run honestly. Hosts supply
25+
compatible bindings. Typed interfaces and transformation behavior stay invariant
26+
across local, sandboxed, and remote placement.
27+
28+
This supersedes D-026's no-placement/no-rung-walk exception and reconciles
29+
`spec/placement.md`, PIR-012, component 4's manifest description, and the
30+
LANG/PROFILE distinction in `spec/errors.md`. D-026 stays in source history;
31+
D-052 supersedes it explicitly. The broader D-040 draft is not ratified by
32+
this amendment.
33+
34+
Source sync accompanies this amendment in DSPy's `roadmap/IR-program-spec.md`
35+
(§Adapter-notes, §e0-lang, §e0-class) and `roadmap/adapter-ir-spec.md`
36+
(ADP-002, §9). Related planning summaries point to D-052. No implementation,
37+
profile predicate, schema, corpus, or version pin changes.
38+
39+
## Preserved limits
40+
41+
- Single-shot remains PIR-008/L2. Adapter code cannot call an LM, including
42+
through a tool/interpreter grant bridge. Multi-call policies remain explicit
43+
component-5 control flow: authored, lowered, or refused.
44+
- Adapter code holds no credential values. Artifacts declare names, never
45+
values (PIR-005). Hosts own executor transport authentication. Declared
46+
execution transport is not hidden inference or ambient network access by
47+
the transformation. This does not select a broker or change TLS policy.
48+
- Identity differs from location. Identity deviations detach scores;
49+
re-placement is recorded without detaching them (PIR-010).
50+
- Receiver bindings win before sidecar materialization. Unsatisfied requirements
51+
refuse loudly. No fixed backend or mandatory sidecar is introduced.
52+
- Isolation remains independent: floors bake, envelopes bind. No silent floor
53+
reduction, trust bypass, or new effect permission follows from placement.
54+
- D-023/DT-002/DT-003 still limit declared-tier adapters to data-only entries
55+
and exclude authored-origin code. Remote placement does not make code data-only.
56+
- Holding declarations does not authorize running them. No new load-time
57+
execution permission follows from this amendment.
58+
59+
## Context, not executor evidence
60+
61+
LMCC `contract/spec/kernel.md` §5 and its decision D-24 already describe shipped
62+
formats with `write`, `read`, optional `describe`, `language`, `deps`, `sha256`,
63+
and `authored_by`. Loading does not run these functions. Hosts admit or refuse
64+
execution. Section 6's strategy `placement` instead routes field values into
65+
messages or controls; it does not place executable code.
66+
67+
LMCC D-24 and kernel §9 state that Go leaves `udf:python` cases unclaimed.
68+
Go's `lmcc/formats.go` verifies the hash, then refuses with `udf-unplaceable`;
69+
it supplies no code placer. Thus existing data-path conformance cannot prove
70+
local, sandboxed, or remote format executor support. This amendment neither
71+
changes LMCC nor adopts a new LMCC protocol.
72+
73+
## Follow-up gates, not implemented behavior
74+
75+
1. Specify and review the code/placement declaration shape and versioning.
76+
Decide placement ownership within component 4, code identity/dependency
77+
verification, binding compatibility, and typed value marshaling. Do not
78+
infer an adapter ABI from existing tool/interpreter data-plane rules.
79+
2. Specify host admission and execution boundaries, refusal codes/details,
80+
lifecycle, resource limits, cancellation, transport authentication, and
81+
provenance. Preserve no hidden effects or LM calls. No backend is selected.
82+
3. Reconcile `schema/manifest.schema.json` descriptions after review, notably
83+
`$defs.code_identity.properties.origin` (obsolete D-026 exclusion) and
84+
`$defs.adapter_preset_ref` (obsolete builtin-only profile wording).
85+
`$defs.adapter_full_preset` still describes a valid profile limit but cites
86+
D-026; cite D-023/DT-003 instead. These schema texts remain unchanged here
87+
because schema edits are outside this documentation amendment's scope.
88+
Permissive schema slots do not establish a new byte contract or executor.
89+
4. Add reviewed structural fixtures for declarations, compatibility/refusal,
90+
identity versus re-placement, and unchanged declared-tier exclusions.
91+
Add execution fixtures for binding-first selection, unsatisfied placement,
92+
invariant typed results, no hidden LM calls, credential isolation, and
93+
floor enforcement. Use AUTHORITY's evidence rules and dedicated fixture
94+
commits with no spec changes. Existing fixtures remain historical evidence
95+
for their pinned operations, not coverage of a new execution path.
96+
5. Implement and test each claimed executor only after those gates. Keep
97+
unsupported capabilities refused or explicitly unclaimed. Existing grade,
98+
profile, and corpus claims do not widen automatically.

‎spec/errors.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Python type names).
1616
| `LINK` | dangling refs | `-001` binding names absent pool entry · `-002` delta without entry |
1717
| `VERIFY` | declared-tier verification | `-001` credential unresolved (names name+scope) · `-002` endpoint serves wrong identity · `-003` system dep missing · `-004` envelope under-runs the effective isolation floor (names leaf + floor + envelope; D-042, PIR-015/016) · `-005` declared grant unsupplied by the envelope (names grant + leaf; D-042/D-043, PIR-018) |
1818
| `NODE` | node-set compile refusal | `-001` un-whitelisted node (names node kind + location) · `-002` unresolved call (names target + location) · `-003` record-splat key refused — splat/kwarg collision or callee-unaccepted key (names key + location; D-041) · `-004` write to the read-only input record (names record + location; D-041) |
19-
| `LANG` | cross-language / rung-walk | `-001` no satisfiable rung (names component + language + rungs tried). Adapter-layer code never enters the walk (D-026) — its refusal is `PROFILE`, not `LANG` |
20-
| `PROFILE` | profile predicate | `-001` clause violated (names clause id) · `-002` authored-origin adapter code present (the D-026 refusal) |
19+
| `LANG` | cross-language / rung-walk | `-001` no satisfiable rung (names component + language + rungs tried). D-052 removes the adapter exception; profile admission still applies before walking. Adapter executor refusal details remain a separate fixture gate (spec/placement.md) |
20+
| `PROFILE` | profile predicate | `-001` clause violated (names clause id) · `-002` authored-origin adapter code present outside an engine's claimed profile (D-023/DT-003; D-052 preserves this profile limit, not a universal code ban) |
2121
| `SHIM` | protocol-level failures, reserved | `-001` internal shim error (carries native error name) · `-002` unknown op · `-003` malformed request — distinct from artifact refusals so the harness can tell "artifact refused" from "shim broke" |
2222

2323
## Rules

‎spec/invariants.md‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,13 @@ design-intent style with ratification date.
7272
is the author's preflight. WHY (D-023).
7373
- **PIR-012 — Language is declared.** Every `packaged` and `authored` code
7474
entry carries `language`; the artifact carries one env block per language
75-
present. Authored adapter-layer code never rung-walks (templates-as-data
76-
are the portable customization path). WHY (D-025, D-026).
75+
present. Executable adapter/format entries also declare code identity,
76+
dependencies, execution requirements, and placement needs; hosts bind
77+
compatible execution without changing the typed transformation contract.
78+
Data-only templates need no code placement. Authored-origin code remains
79+
outside the declared-tier profile. WHY (D-025; D-052 supersedes D-026's
80+
no-placement/no-rung-walk exception; spec/placement.md). The concrete
81+
code/placement ABI remains a separate specification and fixture gate.
7782
- **PIR-013 — The signature is sacred; exhaust is never program state.**
7883
Prediction fields = declared output fields, no more, no less; mechanism
7984
exhaust (`_trajectory`) is observability, never serialized as program

‎spec/manifest.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ ratified contract field.
1414
| 1 | module tree + bindings | tree | leaves bind `{adapter, lm, delta?}` by name |
1515
| 2 | signature | per-predictor | fields: name, direction, desc, shape (JSON Schema, constraints included), semantic_role; `prefix` optional-deprecated |
1616
| 3a/3b/3c | instructions / demos / config | per-predictor | instructions live here only; demos carry `input_keys[]` |
17-
| 4 | adapter pool | pool | adapter-ir preset entries, by reference to that contract |
17+
| 4 | adapter pool | pool | adapter-ir preset entries, by reference to that contract; executable format identity/requirements and placement are permitted by D-052 (spec/placement.md), with byte shape still to specify |
1818
| 5 | forward | per-module | node-set JSON (`spec/node-set.md`) |
1919
| 6 | tools | pool | identity + return_schema + source + deps + language + placement |
2020
| 7 | interpreter | pool | open structural identity profile + placement; legacy fused `kind` readable only |

‎spec/placement.md‎

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,45 @@
11
# Placement — the ladder, the rung-walk, the declared-tier profile
22

3+
## Executable adapters and formats (D-052)
4+
5+
Adapters are where program code meets the LM; formats can carry executable
6+
code. Purity means declared transformations without hidden LM calls or
7+
effects, not absence of code or execution placement. This supersedes
8+
D-026's universal ban on adapter placement and rung-walking.
9+
10+
Executable entries must declare code identity, dependencies, language,
11+
execution requirements, and enough placement information to run honestly.
12+
Hosts supply compatible bindings or refuse loudly. The typed transformation
13+
interface and behavior stay invariant across local, sandboxed, and remote
14+
placement. Data-only templates need no code placement.
15+
16+
The existing placement laws apply: identity differs from location; a receiver
17+
binding wins before sidecar materialization; re-placement is recorded.
18+
Identity deviations detach scores, placement changes do not (PIR-010).
19+
Isolation is independent of placement: floors bake, envelopes bind, and a
20+
host cannot silently lower a floor. Placement never bypasses profile or trust
21+
admission. The declared-tier profile below still excludes authored-origin code.
22+
23+
Component 4 still cannot call an LM or hold credential values. Single-shot
24+
behavior and explicit component-5 multi-call control flow remain (PIR-008).
25+
The tool/interpreter leaf's declared-call permission does not extend to
26+
adapter transformations. Host-mediated transport to a declared executor is
27+
not an LM call or ambient network access by the transformation. Transport
28+
authentication belongs to the host, outside adapter code; the artifact names
29+
credentials but never carries their values (PIR-005).
30+
31+
**Boundary of this amendment:** D-052 records the maintainer-authorized
32+
principle, not approval of a new execution ABI. The code/placement byte shape,
33+
host binding API, value marshaling, and sidecar lifecycle remain separate
34+
specification and fixture gates. Existing tool/interpreter transports do not
35+
establish an adapter ABI. Current schemas, fixtures, and conformance claims
36+
do not establish support for new format executors. See
37+
`changes/2026-09-07-adapter-code-placement.md` for evidence and follow-ups.
38+
39+
LMCC kernel §5's shipped `write`/`read`/`describe` formats supply context, not
40+
a required backend or ABI. LMCC strategy `placement` (§6) routes field values
41+
into messages or controls; it does not place executable code.
42+
343
## The placement block (per placeable component)
444

545
```json
@@ -112,6 +152,9 @@ Every walk is recorded as a re-placement in provenance. Sidecar wire
112152
contracts are out of 1.0 scope (candidates in dspy D-027). Whether the
113153
walk extends to *other* rung-0 unsatisfiability (RAM, missing GPU) is a
114154
DRAFT open question — D-022 ratifies only the foreign-language trigger.
155+
D-052 removes the adapter component-class exception to this policy; it does
156+
not require declared-tier engines to execute authored code or materialize
157+
sidecars.
115158

116159
## The declared-tier profile (D-023) — grade 2's v1 target
117160

0 commit comments

Comments
 (0)