Compare commits

..
7 Commits
Author SHA1 Message Date
chrnxandClaude Opus 5 3cd0ddfe0b docs: agent rules scoped to the library
Constraints that exist because breaking them produced a wrong result: affect.py holds no
tensor, kappa=0 stays a single flag, memory is keyed by stable id, detach does not clear.
Records the two occasions a full suite passed against a deliberately broken implementation,
and the properties the tests now defend.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KAWnnPg2qvmLNySamE2k85
2026-09-02 13:02:03 -05:00
chrnxandClaude Opus 5 27ca5778e3 test(core): make organism memory tests load-bearing (spec §4)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KAWnnPg2qvmLNySamE2k85
2026-09-01 23:57:02 -05:00
chrnxandClaude Sonnet 5 95f10f2953 feat(core): gated relational perceptron and organism with per-entity memory (spec §4)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G1oTwYmaHDJnnqLdmtQW9i
2026-09-01 23:51:43 -05:00
chrnxandClaude Opus 5 85a0f9d86a fix(core): correct omega comment to match actual init behavior
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KAWnnPg2qvmLNySamE2k85
2026-09-01 23:49:46 -05:00
chrnxandClaude Opus 5 23f06e1ff5 feat(core): affective CPPN and relational perceptron (spec §3–§4)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KAWnnPg2qvmLNySamE2k85
2026-09-01 23:46:45 -05:00
chrnxandClaude Opus 5 8822ab3cd8 feat(affect): two-axis affect from the error stream (spec §5)
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KAWnnPg2qvmLNySamE2k85
2026-09-01 23:43:01 -05:00
chrnxandClaude Opus 5 f0e29d1341 chore: scaffold ailed library
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KAWnnPg2qvmLNySamE2k85
2026-09-01 23:41:21 -05:00
2 changed files with 3 additions and 46 deletions

No files matched your search

+3 -11
View File
@@ -16,17 +16,9 @@ class AffectiveCPPN(nn.Module):
super().__init__()
self.l1 = nn.Linear(coord_dim + n_edge_types + context_dim, hidden)
self.l2 = nn.Linear(hidden, out_dim)
# omega scales the sine pre-activation and sets the kernel bandwidth. This was
# documented as "a calibration knob that wants tuning against the domain's length
# scale"; experiments/results/omega.md measured that and it is FALSE over the range
# tested -- the best omega sits at 2-4 for a domain bandwidth varying 4.7x, and 8 is
# an optimisation cliff for every domain tried. What the domain changes is the
# penalty for being under-banded, not where the optimum is.
# The default of 10.0 is OUTSIDE that plateau and every chess result was produced at
# it. It is left alone rather than silently changed: those results are comparisons at
# a fixed omega and stay fair, and one synthetic teacher family is not enough to move
# a library default. Pass omega explicitly, and measure it for a new domain.
# l1 deliberately keeps PyTorch's default init.
# omega scales the sine pre-activation and sets the kernel bandwidth; it is
# a calibration knob that wants tuning against the domain's length scale
# (the particles domain's sigma). l1 deliberately keeps PyTorch's default init.
self.omega = omega
def forward(self, r: Tensor, edge_onehot: Tensor, context: Tensor) -> Tensor:
-35
View File
@@ -179,38 +179,3 @@ def test_detach_memory_cuts_graph():
_, mem = org(attrs, r, ids, (0.0, 0.0), {})
assert all(m.requires_grad for m in mem.values())
assert not any(m.requires_grad for m in detach_memory(mem).values())
# --- Property card rows: what the RP is, asserted rather than assumed. -------------------
# These two are not experiments and must never become them. They state properties that hold
# by construction, and exist so a future change cannot remove one silently. Both were checked
# against a deliberately broken RP (see results/rp_properties.md) and both failed there.
def test_rp_same_parameters_any_n():
"""One parameter set serves any entity count. A fixed-weight layer over N entities is
not worse here, it is undefined: its input dimension is N (or N^2) and has to be chosen."""
rp = RelationalPerceptron(D_ATTR, K, E, C, hidden_dim=H)
before = [p.clone() for p in rp.parameters()]
for n in (2, 7, 32):
attrs, coords = torch.randn(n, D_ATTR), torch.rand(n, K)
edge = torch.zeros(n, n, E); edge[..., 0] = 1.0
h = rp(attrs, flat_diff(coords), edge, torch.ones(n, n), torch.tensor([0.1, 0.2]))
assert h.shape == (n, H)
assert all(torch.equal(a, b) for a, b in zip(before, rp.parameters())) # no shape adapted
def test_organism_permutation_equivariance_with_memory():
"""The RP-level test uses positional tensors; the Organism keys memory by entity id, which
is a second place the order could leak in."""
org = make_org(memory=True)
attrs, coords, _, _, _ = make_inputs()
r, ids = flat_diff(coords), list(range(N))
mem = {i: torch.randn(H) for i in ids}
y0, m0 = org(attrs, r, ids, (0.0, 0.0), mem)
perm = torch.randperm(N)
ids_p = [ids[k] for k in perm.tolist()]
y1, m1 = org(attrs[perm], flat_diff(coords[perm]), ids_p, (0.0, 0.0), mem)
assert torch.allclose(y0[perm], y1, atol=1e-5)
assert all(torch.allclose(m0[i], m1[i], atol=1e-5) for i in ids)