← All Event Families v1.0 live on Codeberg · 2026-04-14 · Apache-2.0
OpenEarth

foundation.protocols.ai.ias.claude.*

DICSTAMACH — Dynamic Interactive Claude State Machine. The introspection layer complementing ai.claude.* (intention) and ai.gryph.* (execution): what knowledge the agent had loaded, when it garbage-collected (with user consent), and when context pressure crossed thresholds. 8 primary events · 2 reusable verify sub-types · matching verify correlation convention.

8
Primary
2
Verify sub-types
v1.0
Released

Contents

Overview

These events capture an AI coding agent's context-state transitions — what knowledge domains were loaded into its working context, when, why, when garbage-collected (with user consent), and when context pressure crossed operational thresholds. They complete the three-layer audit triad alongside existing families:

LayerFamilyObserverAnswers
Intentionai.claude.*Claude bridge on Anthropic APIWhat did the agent say it was going to do?
Executionai.gryph.*Gryph hook on Claude Code runtimeWhat did the system actually see happen?
Introspectionai.ias.claude.*Claude bridge parsing DICSTAMACH markersWhat did the agent's working memory look like while it was thinking?

All three share a single session_id. A DICSTAMACH event explains the state of agent memory between any two ai.claude.* or ai.gryph.* events. Per the project-wide verification convention (see CORRELATION), each primary event MAY have one or more verify events from independent observers — most commonly a gryph-based hook, which confirms the OS-level writes to STATEOFCLAUDE.md and reads of the domain source file.

Canonical source: the authoritative markdown spec lives at codeberg.org/foundationprotocols/foundation-protocols-spec/spec/ai/ias.md — 504 lines, full field tables, all JSON examples, emission rules.

Common Fields

All foundation.protocols.ai.ias.claude.* primary events include:

FieldTypeRequiredDescription
session_idstring (UUID)yesSame ID as ai.claude.session.start and ai.gryph.session.start
sequenceintegeryesMonotonic counter within the DICSTAMACH stream
timestampstring (ISO 8601)yesUTC timestamp of the state transition
turn_countintegeryesTurn number in the session when the event fires
schemastringyesDICSTAMACH schema version, e.g. "DICSTAMACH v1.0"

1. Session Lifecycle

2 events — session.start, session.end.

Timeline Event

foundation.protocols.ai.ias.claude.session.start

Fires once per session at Gate 0 pre-flight, after the agent reads STATEOFCLAUDE.md and resets all domain states to INDEXED.

FieldTypeDescription
domains_totalintegerNumber of non-kernel domains in the hook table
domains_initial_statestringAlways "INDEXED" at session start
context_budget_charsintegerMax target size for CLAUDE.md + loaded reference content
kernel_charsintegerMeasured size of the kernel
gc_thresholdnumberPressure ratio at which GC fires. Default 0.80
previous_session_idstring (UUID) or nullImmediate previous session for continuity. Null on first-ever session
{
  "type": "foundation.protocols.ai.ias.claude.session.start",
  "content": {
    "session_id": "2026-04-14T09:00Z",
    "sequence": 1,
    "timestamp": "2026-04-14T09:00:00Z",
    "turn_count": 0,
    "schema": "DICSTAMACH v1.0",
    "domains_total": 12,
    "domains_initial_state": "INDEXED",
    "context_budget_chars": 40000,
    "kernel_chars": 26000,
    "gc_threshold": 0.80,
    "previous_session_id": "2026-04-13T16:35Z"
  }
}
Timeline Event

foundation.protocols.ai.ias.claude.session.end

Fires at Gate 9 clean session close, or as recovered state at next-session Gate 0 for unclean close. Summarises the session's DICSTAMACH activity.

FieldTypeDescription
reasonstringValues: session_end, session_end_unclean, commit, pressure_exhausted
final_turn_countintegerTotal turns in the session
domains_loaded_finalintegerCount of LOADED domains at close
domains_active_finalintegerCount of ACTIVE domains at close
context_pressure_finalnumber(kernel_chars + loaded_chars) / context_budget_chars
gc_proposals_totalintegerCount of gc.proposed events this session
gc_acceptances_totalintegerCount of gc.accepted events this session

2. Domain Transitions

2 events — domain.loaded, domain.unloaded.

Timeline Event

foundation.protocols.ai.ias.claude.domain.loaded

Fires when a domain transitions INDEXED → LOADED — the agent reads the domain's source file into context for the first time this session (or re-reads after a prior GC).

FieldTypeDescription
domainstringDomain key from the hook table, e.g. "daicas_arch"
sourcestringFile path that was read, relative to project root
charsintegerCharacter count of the file content loaded
trigger_typestringValues: hook_word, user_request, task_plan
trigger_matchedstringThe trigger word or short description of why this domain loaded
loaded_at_turnintegerTurn when this happened
{
  "type": "foundation.protocols.ai.ias.claude.domain.loaded",
  "content": {
    "session_id": "2026-04-14T09:00Z",
    "sequence": 4,
    "timestamp": "2026-04-14T09:12:00Z",
    "turn_count": 3,
    "schema": "DICSTAMACH v1.0",
    "domain": "daicas_arch",
    "source": "config/dicstamach/ref-daicas-architecture.md",
    "chars": 3770,
    "trigger_type": "hook_word",
    "trigger_matched": "DAICAS",
    "loaded_at_turn": 3
  }
}
Timeline Event

foundation.protocols.ai.ias.claude.domain.unloaded

Fires when a domain transitions LOADED → INDEXED via consent-gated GC. Always paired with a preceding gc.accepted.

FieldTypeDescription
domainstringDomain key being released
chars_releasedintegerCharacter count freed
unloaded_reasonstringValues: gc_accepted_all, gc_accepted_selective, session_end
loaded_for_turnsintegerNumber of turns the domain was LOADED
last_referenced_at_turninteger or nullMost recent turn where content was actively used
gc_acceptance_event_idstring or nullMatrix event_id of the paired gc.accepted. Null for session-end cleanup

3. Garbage Collection

3 events — gc.proposed, gc.accepted, gc.declined. Consent-gated: the agent NEVER unloads without explicit user approval.

Timeline Event

foundation.protocols.ai.ias.claude.gc.proposed

Fires when the agent proposes garbage collection — either pressure crossed gc_threshold, or a LOADED domain went 5+ turns unreferenced.

FieldTypeDescription
trigger_reasonstringValues: pressure_threshold, stale_domain
pressure_rationumberCurrent (kernel_chars + loaded_chars) / context_budget_chars
pressure_thresholdnumberThreshold value triggering GC
candidatesarray of objectsEach: {domain, loaded_at_turn, last_used_at_turn, chars}. Sorted by staleness.
candidates_total_charsintegerSum of chars across all candidates
pinned_domainsarray of stringsDomain keys that would have been candidates but are pinned
Timeline Event

foundation.protocols.ai.ias.claude.gc.accepted

Fires when the user consents to GC. A single event covers whole or partial acceptance; domains_released is authoritative about what transitioned.

FieldTypeDescription
proposal_event_idstringMatrix event_id of the gc.proposed this responds to
acceptance_modestringValues: all, selective, pin_only
domains_releasedarray of stringsDomain keys that transitioned LOADED → INDEXED
domains_keptarray of stringsDomain keys proposed but kept loaded
chars_releasedintegerSum of chars freed
post_gc_pressure_rationumberPressure after release
Timeline Event

foundation.protocols.ai.ias.claude.gc.declined

Fires when the user refuses GC — explicit n, all candidates pinned, or no-response timeout.

FieldTypeDescription
proposal_event_idstringMatrix event_id of the gc.proposed being declined
decline_reasonstringValues: user_n, all_pinned, no_response
domains_kept_loadedarray of stringsEvery candidate that stayed LOADED
pressure_ratio_unchangednumberPressure remains at pre-proposal value

4. Pressure Signals

1 event — pressure.threshold.

Timeline Event

foundation.protocols.ai.ias.claude.pressure.threshold

Fires when the context-pressure ratio crosses a defined threshold — upward (rising) or downward (after GC). Decoupled from gc.proposed because pressure signals are useful even when GC is not proposed.

FieldTypeDescription
pressure_rationumberNew pressure ratio after crossing
threshold_crossednumberSpecific threshold value (0.50, 0.80, 0.95, etc.)
directionstringValues: upward, downward
kernel_charsintegerCurrent kernel size
loaded_charsintegerCurrent chars across all LOADED domains
active_domainsintegerCount of ACTIVE domains

Typical sequence: pressure.threshold (upward, 0.80)gc.proposedgc.accepted or gc.declined → zero or more domain.unloadedpressure.threshold (downward, 0.80).

5. Verify Sub-types

This family uses two reusable verify sub-types per the correlation convention. Each uses Matrix's native m.relates_to with rel_type: "foundation.protocols.verify.v1" pointing at the primary event.

Verify

….verify.gryph.statefile_write

Fires when a gryph-based hook observes a Write tool-call targeting STATEOFCLAUDE.md consistent with the primary DICSTAMACH event.

FieldTypeDescription
statefile_pathstringPath to the observed STATEOFCLAUDE.md
bytes_writtenintegerTotal bytes in the Write payload
content_hashstringSHA-256 of the post-write content
diff_summaryobject{domains_changed: [...], fields_changed: [...]}
tool_use_idstringGryph's tool_use_id for cross-reference with ai.gryph.*
{
  "type": "foundation.protocols.ai.ias.claude.domain.loaded.verify.gryph.statefile_write",
  "content": {
    "m.relates_to": {
      "event_id": "$primaryDomainLoaded:matrix.org",
      "rel_type": "foundation.protocols.verify.v1"
    },
    "session_id": "2026-04-14T09:00Z",
    "observed_at": "2026-04-14T09:12:01.523Z",
    "verifier": "gryph-hook",
    "verifier_version": "v0.6.0",
    "primary_event_id": "$primaryDomainLoaded:matrix.org",
    "primary_event_type": "foundation.protocols.ai.ias.claude.domain.loaded",
    "statefile_path": "/workspace/STATEOFCLAUDE.md",
    "bytes_written": 7754,
    "content_hash": "sha256:abcdef...",
    "diff_summary": {
      "domains_changed": ["daicas_arch"],
      "fields_changed": ["domains.daicas_arch.state", "domains.daicas_arch.loaded_at_turn"]
    },
    "tool_use_id": "toolu_01ABC..."
  }
}
Verify

….verify.gryph.file_read

Fires when a gryph-based hook observes a Read tool-call targeting the domain's source file close in time to a primary domain.loaded.

FieldTypeDescription
source_pathstringPath of the file that was read
bytes_readintegerTotal bytes returned
content_hashstringSHA-256 of the content read
tool_use_idstringGryph's tool_use_id for the observed Read

6. Applicability Matrix

Which verify sub-type applies to which primary event:

Primary event.verify.gryph.statefile_write.verify.gryph.file_read
session.start
session.end
domain.loaded
domain.unloaded
gc.proposed
gc.accepted
gc.declined
pressure.thresholdN/A — pure introspection

pressure.threshold is marked N/A because pressure computation is pure agent introspection — the agent computes (kernel_chars + loaded_chars) / budget from its own knowledge of what it loaded. A gryph-based hook has no independent view of "chars in context".

7. Example Session Event Sequence

An illustrative sub-session showing the primary + verify pattern during a load and a GC cycle:

1ai.ias.claude.session.start012 domains INDEXED
1v….session.start.verify.gryph.statefile_write0gryph confirms state init
2ai.claude.session.start0bridge self-reports
3ai.gryph.session.start0hook self-reports
18ai.ias.claude.domain.loaded (daicas_arch, "DAICAS")3
18a….domain.loaded.verify.gryph.file_read3Read of ref file confirmed
18b….domain.loaded.verify.gryph.statefile_write3STATEOFCLAUDE.md updated
37ai.ias.claude.pressure.threshold (upward, 0.80)28no verify — pure introspection
38ai.ias.claude.gc.proposed28
38v….gc.proposed.verify.gryph.statefile_write28proposal metadata persisted
41ai.ias.claude.gc.accepted (selective)29
41v….gc.accepted.verify.gryph.statefile_write29
42ai.ias.claude.domain.unloaded30
42v….domain.unloaded.verify.gryph.statefile_write30state transition persisted
43ai.ias.claude.pressure.threshold (downward, 0.80)30no verify
87ai.ias.claude.session.end45clean exit via Gate 9
87v….session.end.verify.gryph.statefile_write45Gate 9 finalisation confirmed

Missing a v line for any row where one is expected is an audit signal.

8. Emission Rules (Normative)

Full emission-paths implementation notes — including the bridge-side marker protocol and the gryph-side Check observing Writes to STATEOFCLAUDE.md — are in the canonical spec at Codeberg.