You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The amplifier-foundation API is fully documented via Python docstrings and type hints. This overview lists what's exported; for details, read the source files directly.
Why this approach? Documentation that duplicates code becomes context poisoning when it drifts. The code IS the authoritative reference.
Portable same-host checkpoints live in session/shared_state.py. They are supported for POSIX local filesystems and coordinate one writer per canonical workspace and session ID.
Export
Source
Purpose
FileStamp, file_stamp(path)
session/shared_state.py
Metadata-only checkpoint change detection; never reads JSON.
SharedSessionStore
session/shared_state.py
Addresses a checkpoint; acquire(app=...) returns the exclusive writer capability.
HeldSession
session/shared_state.py
Process-bound, non-copyable writer; atomically writes messages, portable bundle reference, and credential-safe metadata. Its live delete_checkpoint() safely removes only the authoritative checkpoint.
SessionBusyError
session/shared_state.py
Contention error with advisory, bounded owner diagnostics.
SessionTransferFencedError, HeldTransfer
session/shared_state.py
Durable native-history admission fence and restricted receipt-matched resolution capability; see session transfer fences.
Import these names from amplifier_foundation.session. Store construction, read, stamp, and list_ids never create state directories. acquire alone creates or validates private state directories and the stable session.lock; it rejects symlinked, foreign-owned, or group/world-accessible state paths. release never rewrites the authoritative checkpoint. See SHARED_SESSION_STATE.md for the same-host participant contract, warm-reuse guidance, and safe checkpoint deletion.
Spawn Utilities
Utilities for spawning sub-sessions with provider/model preferences.
Export
Source
Purpose
ProviderPreference
spawn_utils.py
Dataclass for provider/model preference (supports glob patterns)
apply_provider_preferences
spawn_utils.py
Apply ordered preferences to mount plan
resolve_model_pattern
spawn_utils.py
Resolve glob patterns (e.g., claude-haiku-*) to concrete model names
is_glob_pattern
spawn_utils.py
Check if model string contains glob characters
Cost Bridge Utilities
Utilities for propagating child-session costs to parent coordinators in
app-layer spawn wrappers. Import via from amplifier_foundation import ....
Export
Source
Purpose
bridge_child_cost
bundle/_prepared.py
Collect child session's session.cost contributions and register them as a single contributor on the parent coordinator. Never raises — errors are logged as warnings.
sum_cost_usd
bundle/_prepared.py
Sum a list of collect_contributions() results into a single Decimal | None. Returns None when no cost data is present. Tolerates both Decimal and str values.
Reading the Source
Each source file has comprehensive docstrings. To read them:
# In your editor
code amplifier_foundation/bundle.py
# Or via Python
python -c "from amplifier_foundation import Bundle; help(Bundle)"# Or via pydoc
python -m pydoc amplifier_foundation.Bundle
Local mentions in the initial text use the resolver's base directory, or the
explicit relative_to passed to load_mentions. Inside an included file, explicit
relative mentions (@./journal.md or @../rules.md) use that file's directory.
Bare local mentions such as @AGENTS.md retain the resolver's workspace root;
this preserves bundles that intentionally include the current project's rules.
Bundle namespaces and explicit home/absolute paths retain their own roots.
The resolver is never mutated while loading a nested file. Content is included
once, but identical instruction files in different directories still load their
own relative references. Missing files remain optional; recursion depth and
canonical-path cycle detection bound traversal.
Bundle-declared context: files use the same recursive loading rules.
load_mentions_from_file(path, resolver, deduplicator) exposes that path-based
entry point without reparsing filenames as mention syntax. This affects context
assembly, not ordinary file-tool results or attachments, whose content remains
literal.
Custom resolvers keep the existing resolve(mention) contract. To support
per-file relative resolution, also implement the optional
RelativeMentionResolverProtocol.resolve_relative(mention, relative_to) method.
App shortcuts such as @user: and @project: should retain their configured
roots. Legacy resolvers without that method continue to resolve exactly as before.