Skip to content

RFD: predicate caching#262

Open
kurasaiteja wants to merge 4 commits into
symposium-dev:mainfrom
kurasaiteja:rfd-predicate-caching
Open

RFD: predicate caching#262
kurasaiteja wants to merge 4 commits into
symposium-dev:mainfrom
kurasaiteja:rfd-predicate-caching

Conversation

@kurasaiteja

@kurasaiteja kurasaiteja commented Jul 13, 2026

Copy link
Copy Markdown

What does this PR do?

Updated V4

RFD for predicate caching. Custom predicates currently fork a process on every sync. This adds a small JSONL protocol that lets a predicate report the inputs its result depends on, so Symposium can cache the result and skip reevaluation until one of those inputs changes.

Protocol

We add three granular events on a #[non_exhaustive] enum:

  • WatchFile(PathBuf) - result depends on this file
  • WatchEnv(String) - result depends on this environment variable
  • WatchTime(usize) - result becomes stale after this many milliseconds

A predicate can emit any number of events during one run. Its exit status still determines true or false. No events means cached indefinitely. WatchTime(0) means never cached. shell(cmd) emits WatchTime(0).

Storage

Cache lives at ~/.symposium/cache/predicates.json and is discarded on Symposium version upgrade.

Disclosure questions AI disclosure.

I used an AI tool for research, autocomplete, or in other minimal ways.
AI tool authored most of this RFD

Add design for caching predicate results using file-based watch paths.
Two mechanisms: syntactic (watch field on skill groups) and runtime
(stdout JSON from shell predicates). Coordinates with PM interface
for depends-on() caching via Cargo.lock.

@nikomatsakis nikomatsakis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Left some notes here.

Comment thread md/rfds/predicate-caching/README.md Outdated
Comment thread md/rfds/predicate-caching/README.md Outdated
Comment thread md/rfds/predicate-caching/README.md Outdated
Comment thread md/rfds/predicate-caching/README.md Outdated
@kurasaiteja
kurasaiteja force-pushed the rfd-predicate-caching branch from d1f0781 to d699619 Compare July 14, 2026 17:47

@nikomatsakis nikomatsakis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much better! Left a few more comments.

Comment thread md/rfds/predicate-caching/README.md Outdated
Comment thread md/rfds/predicate-caching/README.md Outdated
Comment thread md/rfds/predicate-caching/README.md
switch to granular events on a
non_exhaustive enum, and replace Volatile with WatchTime.

@nikomatsakis nikomatsakis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@nikomatsakis nikomatsakis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!


## SDK helper

The `symposium-sdk` crate provides a helper that reads an environment variable and emits its watch event:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(we should probably also have a helper to e.g. read and deserialize a JSON/TOML file or just to read a file to a string)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants