Agent skill
cache-expert
Covers Dagger Engine caching internals including cache key derivation, invalidation, and the immutable DAG model. Use when debugging cache misses, unexpected invalidations, or implementing caching-related engine features.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/development/cache-expert
SKILL.md
Cache Expert
High-Level Architecture
The Dagger Engine serves a GraphQL-based API for building and executing DAG workflows.
Each operation takes immutable objects/scalar values as inputs and produces an immutable object/scalar value as output. "Mutability" is simulated as a DAG of these operations on immutable values, similar to functional programming.
This enables caching: since inputs are immutable and operations are deterministic, cache keys can be derived from the operation and its inputs.
Key concepts:
- ID: A scalar value that encapsulates the operation that created an object. Enables non-scalar values to be used as inputs to other operations, forming a DAG.
- Digest: A hash derived from an operation and its inputs, used for cache key computation.
- Call Cache Key: Determines whether an operation's result can be retrieved from cache.
Core API Call Anatomy
Every API call has three typed components:
- Parent - The object the operation is called on (e.g.,
Container) - Arguments - The operation's input arguments
- Return value - The result (scalar or object with an ID)
Cache Key Computation
By default, a call's cache key is a hash of:
- Operation name (e.g.,
Container.withExec) - Parent's digest
- Arguments' digests
This matches the default ID digest. See ids.md for details.
Cache Key Customization
Cache keys can be scoped differently:
- Per-client - Cached per connected client
- Per-session - Cached for the duration of a session
- Per-call - Never cached (unique each invocation)
- Custom - Arbitrary cache key logic
Object IDs vs Cache Keys
These are related but distinct:
- Call cache key - Used to look up cached results
- Returned object ID - May equal the cache key, or may be a separate operation
- Object digest - Usually matches call cache key, but can be customized (e.g., content-addressed)
Quick Reference
Jump to the right doc for your task:
| Task | Read |
|---|---|
| Understand how IDs encode operations | ids.md |
| Understand the GraphQL server implementation | dagql-api-server.md |
| Understand how results are cached | cache-storage.md |
| Understand BuildKit integration (being phased out) | buildkit-dagop.md |
| Debug a cache miss | debugging.md |
| Test cache behavior | testing.md |
Core References
Read in order to build deep expertise:
- ids.md - How IDs encode operations and derive digests
- dagql-api-server.md - The dagql GraphQL server implementation
- cache-storage.md - How dagql results are cached
- buildkit-dagop.md - BuildKit integration and its phase-out status
Optional References
Load on-demand for specific tasks:
- debugging.md - Techniques for diagnosing cache misses and unexpected invalidations
- testing.md - How to test cache behavior in the engine
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?