Skip to content

Commit 93de1af

Browse files
Bran Hclaude
andcommitted
Add v0.4 evolutionary specification example to gh-pages
- Add examples/evolution.simplex demonstrating BASELINE and EVAL - Update examples.html with evolution example card - Add Key Observations section explaining evolutionary specs - Update description to reflect 15 landmarks (was 13) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent fc68765 commit 93de1af

2 files changed

Lines changed: 144 additions & 1 deletion

File tree

examples.html

Lines changed: 90 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
layout: default
33
title: Examples
44
permalink: /examples/
5-
description: Simplex specification examples demonstrating authentication, shopping carts, document pipelines, and multi-agent coordination with all 13 landmarks.
5+
description: Simplex specification examples demonstrating authentication, shopping carts, document pipelines, evolutionary specifications, and multi-agent coordination with all 15 landmarks.
66
---
77

88
<div class="spec-content">
@@ -209,6 +209,72 @@ <h3>Document Pipeline</h3>
209209
- on failure: error details with document path for retry queue</code></pre>
210210
</div>
211211

212+
<div class="example-card">
213+
<div class="example-card-header">
214+
<h3>Evolutionary Specification</h3>
215+
<p>Modernizing existing systems with BASELINE and EVAL (v0.4)</p>
216+
</div>
217+
<pre><code>DATA: AuthSystem
218+
session_support: boolean
219+
jwt_support: boolean
220+
refresh_rotation: boolean
221+
rate_limiting: boolean
222+
223+
FUNCTION: modernize_authentication(config) → AuthSystem
224+
225+
BASELINE:
226+
reference: "session-based auth, commit abc123"
227+
preserve:
228+
- POST /login returns { session_id, expires_at }
229+
- session timeout is 30 minutes
230+
- existing client SDKs continue to work
231+
evolve:
232+
- add JWT token issuance alongside sessions
233+
- implement refresh token rotation
234+
- add rate limiting on auth endpoints
235+
236+
RULES:
237+
- authenticate user credentials against user store
238+
- issue JWT token with configurable expiration
239+
- issue refresh token that rotates on each use
240+
- maintain session-based auth for backward compatibility
241+
- rate limit failed attempts per IP address
242+
243+
DONE_WHEN:
244+
- valid credentials produce both session and JWT
245+
- refresh tokens rotate correctly
246+
- rate limiting activates after threshold
247+
- existing session-based clients unaffected
248+
249+
EXAMPLES:
250+
# Preserved behaviors (regression tests)
251+
(valid_creds, session_mode)
252+
→ { session_id: "...", expires_at: +30min }
253+
(invalid_creds, any_mode)
254+
→ { error: "unauthorized" }
255+
256+
# Evolved capabilities (capability tests)
257+
(valid_creds, jwt_mode)
258+
→ { token: "...", refresh: "...", expires_at: +1hr }
259+
(expired_token, valid_refresh)
260+
→ { token: "new...", refresh: "new..." }
261+
(any_creds, after_rate_limit)
262+
→ { error: "rate limited", retry_after: 60 }
263+
264+
ERRORS:
265+
- user store unavailable → "auth service unavailable"
266+
- malformed credentials → "invalid request format"
267+
- rate limit exceeded → "rate limited, retry after {seconds}"
268+
269+
EVAL:
270+
preserve: pass^3
271+
evolve: pass@5
272+
grading: code
273+
274+
CONSTRAINT: backward_compatibility
275+
existing v1 API clients must work without modification</code></pre>
276+
</div>
277+
212278
</div>
213279

214280
<h2 style="margin-top: 3rem;">Key Observations</h2>
@@ -257,4 +323,27 @@ <h3>Swarm Coordination</h3>
257323
enabling agents to coordinate without central orchestration.
258324
</p>
259325

326+
<h3>Evolutionary Specifications (v0.4)</h3>
327+
<p>
328+
When evolving existing systems rather than building greenfield, use <code>BASELINE</code>
329+
and <code>EVAL</code> to declare what must be preserved versus what is being evolved.
330+
</p>
331+
<p>
332+
<code>BASELINE</code> contains three fields: <code>reference</code> (the prior state),
333+
<code>preserve</code> (behaviors that must not regress), and <code>evolve</code>
334+
(capabilities being added or changed).
335+
</p>
336+
<p>
337+
<code>EVAL</code> declares how to measure success using two threshold notations:
338+
<code>pass^k</code> means all k trials must pass (for regression tests), while
339+
<code>pass@k</code> means at least one of k trials must pass (for capability tests).
340+
The <code>grading</code> field specifies evaluation approach: <code>code</code> for
341+
deterministic comparison, <code>model</code> for LLM-as-judge, or <code>outcome</code>
342+
for verifying state changes.
343+
</p>
344+
<p>
345+
EVAL is required when BASELINE is present. This ensures evolutionary specs always
346+
define how preservation and progress are measured.
347+
</p>
348+
260349
</div>

examples/evolution.simplex

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
DATA: AuthSystem
2+
session_support: boolean
3+
jwt_support: boolean
4+
refresh_rotation: boolean
5+
rate_limiting: boolean
6+
7+
FUNCTION: modernize_authentication(config) → AuthSystem
8+
9+
BASELINE:
10+
reference: "session-based auth, commit abc123"
11+
preserve:
12+
- POST /login returns { session_id, expires_at }
13+
- session timeout is 30 minutes
14+
- existing client SDKs continue to work
15+
evolve:
16+
- add JWT token issuance alongside sessions
17+
- implement refresh token rotation
18+
- add rate limiting on auth endpoints
19+
20+
RULES:
21+
- authenticate user credentials against user store
22+
- issue JWT token with configurable expiration
23+
- issue refresh token that rotates on each use
24+
- maintain session-based auth for backward compatibility
25+
- rate limit failed attempts per IP address
26+
27+
DONE_WHEN:
28+
- valid credentials produce both session and JWT
29+
- refresh tokens rotate correctly
30+
- rate limiting activates after threshold
31+
- existing session-based clients unaffected
32+
33+
EXAMPLES:
34+
# Preserved behaviors (regression tests)
35+
(valid_creds, session_mode) → { session_id: "...", expires_at: +30min }
36+
(invalid_creds, any_mode) → { error: "unauthorized" }
37+
38+
# Evolved capabilities (capability tests)
39+
(valid_creds, jwt_mode) → { token: "...", refresh: "...", expires_at: +1hr }
40+
(expired_token, valid_refresh) → { token: "new...", refresh: "new..." }
41+
(any_creds, after_rate_limit) → { error: "rate limited", retry_after: 60 }
42+
43+
ERRORS:
44+
- user store unavailable → "auth service unavailable"
45+
- malformed credentials → "invalid request format"
46+
- rate limit exceeded → "rate limited, retry after {seconds}"
47+
48+
EVAL:
49+
preserve: pass^3
50+
evolve: pass@5
51+
grading: code
52+
53+
CONSTRAINT: backward_compatibility
54+
existing v1 API clients must work without modification

0 commit comments

Comments
 (0)