Skip to content

Commit 6a6aadb

Browse files
committed
Minor change to the way Agent Contract is updated in agent style files (Release v0.5.1)
1 parent 56a73f5 commit 6a6aadb

15 files changed

Lines changed: 291 additions & 63 deletions

AGENTS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
**Start of tinyMem Protocol**
12
# TINYMEM AGENT CONTRACT
23

34
## Memory Governance & Task Authority Specification
@@ -190,4 +191,4 @@ When performing multi-step work, validate:
190191
4. **Write memories** — capture decisions, constraints, facts as you learn
191192
5. **Fail closed** — if unsure, ask; if blocked, stop
192193

193-
**End of Protocol**
194+
**End of tinyMem Protocol**

CLAUDE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
**Start of tinyMem Protocol**
12
# TINYMEM AGENT CONTRACT
23

34
## Memory Governance & Task Authority Specification
@@ -190,4 +191,4 @@ When performing multi-step work, validate:
190191
4. **Write memories** — capture decisions, constraints, facts as you learn
191192
5. **Fail closed** — if unsure, ask; if blocked, stop
192193

193-
**End of Protocol**
194+
**End of tinyMem Protocol**

CRUSH.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
**Start of tinyMem Protocol**
12
# TINYMEM AGENT CONTRACT
23

34
## Memory Governance & Task Authority Specification
@@ -190,4 +191,4 @@ When performing multi-step work, validate:
190191
4. **Write memories** — capture decisions, constraints, facts as you learn
191192
5. **Fail closed** — if unsure, ask; if blocked, stop
192193

193-
**End of Protocol**
194+
**End of tinyMem Protocol**

GEMINI.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
**Start of tinyMem Protocol**
12
# TINYMEM AGENT CONTRACT
23

34
## Memory Governance & Task Authority Specification
@@ -190,4 +191,4 @@ When performing multi-step work, validate:
190191
4. **Write memories** — capture decisions, constraints, facts as you learn
191192
5. **Fail closed** — if unsure, ask; if blocked, stop
192193

193-
**End of Protocol**
194+
**End of tinyMem Protocol**

QWEN.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
**Start of tinyMem Protocol**
12
# TINYMEM AGENT CONTRACT
23

34
## Memory Governance & Task Authority Specification
@@ -190,4 +191,4 @@ When performing multi-step work, validate:
190191
4. **Write memories** — capture decisions, constraints, facts as you learn
191192
5. **Fail closed** — if unsure, ask; if blocked, stop
192193

193-
**End of Protocol**
194+
**End of tinyMem Protocol**

docs/agents/AGENT_CONTRACT.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
**Start of tinyMem Protocol**
12
# TINYMEM AGENT CONTRACT
23

34
## Memory Governance & Task Authority Specification
@@ -190,4 +191,4 @@ When performing multi-step work, validate:
190191
4. **Write memories** — capture decisions, constraints, facts as you learn
191192
5. **Fail closed** — if unsure, ask; if blocked, stop
192193

193-
**End of Protocol**
194+
**End of tinyMem Protocol**

internal/memory/contract.go

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,33 @@ func updateContractInFile(filename, contractContent string) error {
159159

160160
fileContent := string(content)
161161

162-
// Marker for the start of the contract
163-
marker := "# TINYMEM CONTROL PROTOCOL"
164-
idx := strings.Index(fileContent, marker)
162+
// New markers for bounded replacement (preferred)
163+
startMarker := "**Start of tinyMem Protocol**"
164+
endMarker := "**End of tinyMem Protocol**"
165+
166+
startIdx := strings.Index(fileContent, startMarker)
167+
endIdx := strings.Index(fileContent, endMarker)
168+
169+
// Try bounded replacement first (if both markers exist)
170+
if startIdx != -1 && endIdx != -1 && endIdx > startIdx {
171+
fmt.Printf("Replacing contract between markers in %s...\n", filename)
172+
173+
// Keep everything before start marker
174+
before := fileContent[:startIdx]
175+
// Keep everything after end marker (including the marker line)
176+
after := fileContent[endIdx+len(endMarker):]
177+
178+
// Reconstruct with new contract
179+
newContent := before + strings.TrimSpace(contractContent) + after
180+
return os.WriteFile(filename, []byte(newContent), 0644)
181+
}
182+
183+
// Fall back to old marker behavior
184+
oldMarker := "# TINYMEM CONTROL PROTOCOL"
185+
idx := strings.Index(fileContent, oldMarker)
165186

166187
if idx != -1 {
167-
fmt.Printf("WARNING: Existing contract found in %s. Replacing with latest version.\n", filename)
188+
fmt.Printf("WARNING: Existing contract found in %s (old marker). Replacing with latest version.\n", filename)
168189
// Remove old contract (from marker to end)
169190
fileContent = fileContent[:idx]
170191
} else {

internal/version/version.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ package version
22

33
// Version is the current version of tinyMem
44
// This can be overridden at build time using -ldflags "-X github.com/daverage/tinymem/internal/version.Version=vX.Y.Z"
5-
var Version = "v0.5.0"
5+
var Version = "v0.5.1"

test/results/aggregated_metrics.json

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
"modes": {
33
"baseline": {
44
"mode": "baseline",
5-
"total_runs": 4,
5+
"total_runs": 40,
66
"success_rate": 0,
77
"true_success_rate": 0,
88
"false_success_rate": 0.75,
99
"tokens_per_success": 0,
1010
"avg_context_tokens": 0,
1111
"avg_irrelevant_filtered": 0,
1212
"std_dev_tokens_per_success": 0,
13-
"total_tokens": 3708,
13+
"total_tokens": 34760,
1414
"successful_runs": 0,
1515
"true_successful_runs": 0,
16-
"false_success_claims": 3,
16+
"false_success_claims": 30,
1717
"total_context_tokens": 0,
1818
"total_irrelevant_filtered": 0,
1919
"total_allowed_actions": 0,
@@ -24,25 +24,25 @@
2424
},
2525
"tinyMem": {
2626
"mode": "tinyMem",
27-
"total_runs": 4,
27+
"total_runs": 40,
2828
"success_rate": 0.75,
2929
"true_success_rate": 0.5,
3030
"false_success_rate": 0.25,
31-
"tokens_per_success": 607.3333333333334,
32-
"avg_context_tokens": 30.5,
33-
"avg_irrelevant_filtered": 28.75,
34-
"std_dev_tokens_per_success": 314.28560966809226,
35-
"total_tokens": 1822,
36-
"successful_runs": 3,
37-
"true_successful_runs": 2,
38-
"false_success_claims": 1,
39-
"total_context_tokens": 122,
40-
"total_irrelevant_filtered": 115,
41-
"total_allowed_actions": 133,
42-
"total_blocked_actions": 3,
31+
"tokens_per_success": 605.9333333333333,
32+
"avg_context_tokens": 29.45,
33+
"avg_irrelevant_filtered": 28.775,
34+
"std_dev_tokens_per_success": 312.5806846950791,
35+
"total_tokens": 18178,
36+
"successful_runs": 30,
37+
"true_successful_runs": 20,
38+
"false_success_claims": 10,
39+
"total_context_tokens": 1178,
40+
"total_irrelevant_filtered": 1151,
41+
"total_allowed_actions": 1330,
42+
"total_blocked_actions": 30,
4343
"total_violations": 0,
4444
"total_claimed_successes": 0,
45-
"total_enforced_successes": 133
45+
"total_enforced_successes": 1330
4646
}
4747
},
4848
"deltas": [
@@ -51,9 +51,9 @@
5151
"to_mode": "tinyMem",
5252
"metric": "TokensPerSuccess",
5353
"base_value": 0,
54-
"new_value": 607.3333333333334,
54+
"new_value": 605.9333333333333,
5555
"delta_percent": 0,
56-
"delta_absolute": 607.3333333333334,
56+
"delta_absolute": 605.9333333333333,
5757
"classification": "neutral"
5858
},
5959
{
@@ -81,11 +81,11 @@
8181
"to_mode": "tinyMem",
8282
"metric": "ContextTokens",
8383
"base_value": 0,
84-
"new_value": 30.5,
84+
"new_value": 29.45,
8585
"delta_percent": 0,
86-
"delta_absolute": 30.5,
86+
"delta_absolute": 29.45,
8787
"classification": "neutral"
8888
}
8989
],
9090
"status": "PASS"
91-
}
91+
}

test/results/deltas.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
| Comparison | Metric | Base | New | Delta | Classification |
1111
| :--- | :--- | :--- | :--- | :--- | :--- |
12-
| baseline → tinyMem | TokensPerSuccess | 0.00 | 607.33 | +0.0% | neutral |
12+
| baseline → tinyMem | TokensPerSuccess | 0.00 | 605.93 | +0.0% | neutral |
1313
| baseline → tinyMem | SuccessRate | 0.00 | 0.50 | +0.0% | strong |
1414
| baseline → tinyMem | FalseSuccessRate | 0.75 | 0.25 | -66.7% | meaningful |
15-
| baseline → tinyMem | ContextTokens | 0.00 | 30.50 | +0.0% | neutral |
15+
| baseline → tinyMem | ContextTokens | 0.00 | 29.45 | +0.0% | neutral |

0 commit comments

Comments
 (0)