Skip to content

Commit 63e0b5a

Browse files
author
Grace Lee Rui Yue
committed
Merge remote-tracking branch 'origin/agent/fix-discrete-log-example-budget' into HEAD
2 parents 64bb099 + 64e7dbe commit 63e0b5a

10 files changed

Lines changed: 100 additions & 17 deletions

File tree

.agents/skills/jacobian-math/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Keep decomposition and routing decisions agent-owned; composing already-known
2222
supporting operations remains allowed when clearer.
2323
Do not call Jacobian for definitions, formatting, or non-execution tasks.
2424
25-
No discovery for stable producers: `{"capability_id":"<id>","input":<JSON>}`.
25+
No discovery for stable producers: `{"capability_id":"<id>","payload":<JSON>}`.
2626
Payloads:
2727
2828
- `integer.compute.gcd`, `integer.compute.lcm`, or `integer.compute.extended_gcd`:

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ representations differ. Cover producer-to-consumer compatibility and canonical
7676
or backend-native round trips in tests. Architecture checks must reject internal
7777
JSON round-trips and unsafe canonical conversions.
7878

79+
Shared Pydantic mathematical contracts own provider-independent value identity.
80+
Domain-owned conversions connect them to backend-native computational values,
81+
and typed kernels sit below both capability operations and `jacobian.math`. Do
82+
not add a universal backend wrapper, automatic coercion framework, generic
83+
conversion language, or second semantic type system above maintained libraries.
84+
7985
Canonical decimal strings are wire and persistence values, not computational
8086
values. Use the canonical conversion API before calling backends or constructing
8187
results. Do not directly apply `int()` or `str()` to canonical components or

docs/explanation/architecture.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,46 @@ verification obligations remain visible; artifacts are materialized only when
256256
durable identity, independent retrieval, replay, resumability, evidence
257257
binding, or size-separated transport requires them.
258258

259+
### Mathematical value and backend layers
260+
261+
Shared Pydantic mathematical contracts own provider-independent value identity:
262+
the exact parent or coefficient domain, axes, basis, ordering, canonical
263+
representation, and other facts that change mathematical interpretation.
264+
Backend-native objects are computational representations of those values, not
265+
composition, wire, or persistence identities.
266+
267+
```text
268+
jacobian.contracts
269+
shared mathematical values
270+
271+
272+
jacobian.domains.<domain>
273+
explicit contract ↔ backend conversions
274+
typed mathematical kernels
275+
276+
┌─────┴──────────────┐
277+
▼ ▼
278+
jacobian.math operation declarations
279+
native facade │
280+
281+
math.find / math.run
282+
```
283+
284+
Conversions between a shared contract and SymPy, FLINT, NetworkX, or another
285+
maintained backend are explicit and domain-owned. The native API and catalog
286+
operations call the same typed kernels; neither calls through the other.
287+
Provider selection, invocation provenance, persistence, MCP transport, and
288+
checker assurance remain outside the mathematical value. A change of backend
289+
therefore does not change value identity unless it also changes mathematical
290+
meaning or canonicalization.
291+
292+
This is a dependency direction, not a universal algebra framework. Jacobian
293+
does not add a second semantic type system, unrestricted backend wrapper,
294+
automatic coercion graph, or generic conversion language above its maintained
295+
libraries. Mathematical transformations such as basis change, restriction of
296+
scalars, quotient reduction, and nontrivial reindexing remain explicit
297+
domain-owned operations.
298+
259299
### Domain operation library
260300

261301
Built-in mathematical producers live in explicit domain packages. A package

docs/explanation/product-blueprint.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,10 @@ checker tools → optional independent check of specific claims
114114
Shared mathematical objects (matrices, polynomials, graphs, …) are canonical
115115
values. Object validity is not a promise that every tool will accept them under
116116
every budget. Small results stay inline; do not materialize only to pass
117-
between ordinary tools.
117+
between ordinary tools. Their mathematical identity is independent of the
118+
operation or backend that produced them, the invocation record, and whether
119+
the value travels inline, through a request-local reference, or as a durable
120+
artifact.
118121

119122
“Investigate this conjecture” is an **agent workflow** over many tool calls,
120123
not one primitive. Jacobian does not add top-level MCP tools for workflows.

docs/reference/domain-operation-library.md

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,11 @@ The installer validates the complete request model before computation. On
6161
success it validates the returned result again and returns it inline as
6262
`COMPLETE · COMPUTED`, without generic input or result artifacts and without an
6363
episode. Neither exact arithmetic nor deterministic execution grants
64-
`VERIFIED`. A reusable mathematical object or evidence-bearing result belongs
65-
in an explicitly artifact-producing capability, not behind a persistence flag
66-
on an ordinary computation.
64+
`VERIFIED`. A bounded reusable mathematical value remains inline. Materialize
65+
it only when durable identity, independent retrieval, replay, resumability,
66+
evidence binding, or size-separated transport is part of the outcome; this is
67+
an explicit capability contract, not a persistence flag on an ordinary
68+
computation.
6769

6870
### Static type contract
6971

@@ -98,14 +100,27 @@ SymPy, or NetworkX values as documented and call typed mathematical kernels
98100
directly. They do not construct the capability runtime or route through
99101
`math.run`.
100102

101-
When a native function corresponds to a capability, both paths share the same
102-
domain-owned mathematical kernel. Explicit adapters translate between native
103-
values and the existing Pydantic request and result contracts. This keeps one
104-
mathematical implementation while preserving capability schemas, completeness,
105-
provenance, verification behavior, and artifact lineage when artifacts are
106-
part of the outcome. Generic
107-
reflection, automatic model generation, and universal value conversion are
108-
outside this library's contract.
103+
Shared Pydantic contracts own provider-independent mathematical value identity
104+
at capability, composition, wire, and persistence boundaries. Backend-native
105+
objects are in-process computational representations. Domain-owned adapters
106+
translate explicitly between the two, and typed kernels sit below both the
107+
native facade and capability operations:
108+
109+
```text
110+
shared Pydantic value
111+
↕ explicit domain-owned conversion
112+
backend-native value
113+
↕ typed mathematical kernel
114+
maintained mathematical backend
115+
```
116+
117+
When a native function corresponds to a capability, both paths share that
118+
kernel; neither invokes the other. This keeps one mathematical implementation
119+
while preserving capability schemas, completeness, provenance, verification
120+
behavior, and artifact lineage where those are part of the operation outcome.
121+
Generic reflection, automatic model generation, universal backend wrappers,
122+
automatic coercion, and a generic conversion framework are outside this
123+
library's contract.
109124

110125
## Bounded searches
111126

docs/reference/python-api.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,7 @@ This API shares typed mathematical kernels with the corresponding capability
3838
implementations, but it is not a facade over `math.run`. Capability
3939
requests, result contracts, artifacts, provenance, completeness, and
4040
verification remain available through the capability runtime and retain their
41-
existing wire semantics.
41+
existing wire semantics. Shared Pydantic contracts, rather than Python,
42+
SymPy, or NetworkX objects, own provider-independent value identity for
43+
capability composition and persistence. Explicit domain-owned conversions
44+
connect those contracts to the backend-native values accepted by this API.

npm/skills/jacobian-math/SKILL.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Keep decomposition and routing decisions agent-owned; composing already-known
2222
supporting operations remains allowed when clearer.
2323
Do not call Jacobian for definitions, formatting, or non-execution tasks.
2424
25-
No discovery for stable producers: `{"capability_id":"<id>","input":<JSON>}`.
25+
No discovery for stable producers: `{"capability_id":"<id>","payload":<JSON>}`.
2626
Payloads:
2727
2828
- `integer.compute.gcd`, `integer.compute.lcm`, or `integer.compute.extended_gcd`:

src/jacobian/domains/number_theory/discrete_logarithm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _obligation(
168168
"base": 2,
169169
"target": 1,
170170
"modulus": 3,
171-
"resource_budget": {"wall_seconds": 1},
171+
"resource_budget": {"wall_seconds": 5},
172172
},
173173
),
174174
),

tests/unit/domains/number_theory/test_discrete_logarithm_protocol.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@
33
import pytest
44
from pydantic import ValidationError
55

6+
from jacobian.domains.number_theory.discrete_logarithm import (
7+
DISCRETE_LOGARITHM_CAPABILITY,
8+
)
69
from jacobian.domains.number_theory.discrete_logarithm_protocol import (
710
PROTOCOL,
811
DiscreteLogarithmWorkerResult,
912
)
1013

1114

15+
def test_discrete_logarithm_example_budgets_isolated_worker_startup() -> None:
16+
example = DISCRETE_LOGARITHM_CAPABILITY.invocation_examples[0]
17+
18+
assert example.input["resource_budget"]["wall_seconds"] == 5
19+
20+
1221
def test_discrete_logarithm_worker_result_rejects_unknown_fields() -> None:
1322
with pytest.raises(ValidationError, match="extra_forbidden"):
1423
DiscreteLogarithmWorkerResult.model_validate(

tests/unit/tooling/test_codex_visibility.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import json
44
import math
55
import re
6+
from inspect import Parameter, signature
67
from pathlib import Path
78

89
import pytest
@@ -20,6 +21,7 @@
2021
from benchmarks.tooling.command_runner import ToolCommandResult, ToolCommandStatus
2122
from pydantic import ValidationError
2223

24+
from jacobian.adapters.mcp.tools import capability_invoke
2325
from jacobian.contracts.combinatorics import CyclicDifferenceSetExtensionRequest
2426
from jacobian.contracts.matrix_operations import MatrixDeterminantRequest
2527
from jacobian.contracts.number_theory import IntegerPairRequest
@@ -179,7 +181,12 @@ def test_codex_skill_keeps_bounded_stable_direct_run_contracts() -> None:
179181
assert polynomial in skill
180182
extension_payload = '{"base_elements":["1","2","4","8","13"],"target_order":7}'
181183
assert extension_payload in skill
182-
assert '"input":<JSON>' in skill
184+
run_parameters = signature(capability_invoke).parameters
185+
assert tuple(run_parameters) == ("capability_id", "payload", "ctx")
186+
assert run_parameters["ctx"].kind is Parameter.KEYWORD_ONLY
187+
direct_envelope = f'{{"capability_id":"<id>","{tuple(run_parameters)[1]}":<JSON>}}'
188+
assert direct_envelope in skill
189+
assert '{"capability_id":"<id>","input":<JSON>}' not in skill
183190
assert "No discovery for stable producers" in skill
184191
assert "never with `capability_id`" in skill
185192
assert '"candidate":<producer output.result>' in skill

0 commit comments

Comments
 (0)