Skip to content

Rules-aware skip memo: re-decode only changed records, invalidate on any rule change #154

Open

Description

@arimendelow

Prompt

Add to crawlkit a small helper that lets a crawler skip re-decoding source records whose bytes have not changed since the last sync, and that invalidates every skip automatically when the crawler's decoding rules change. API sketch: state.RulesSignature(versions map[string]int, rules any) []byte hashes the declared decoder and derivation versions plus a canonical, path-tagged rendering of the rule tables (strings quoted, maps and sets in key order, compiled regular expressions by pattern; panic on an unknown kind so a new table cannot be skipped silently), and a per-record memo compares (source key, byte digest, signature) before the crawler decodes. Keep record storage in the app; crawlkit owns only the signature and the comparison. Reference implementation: https://github.com/ourostack/teamscrawl/blob/main/internal/teamsdesktop/memo.go (MemoSignature, hashValue).

Why

A crawler that re-reads a large local cache on every sync pays to decode records that have not changed. teamscrawl skips them with a per-record byte digest, which made a re-sync of a real Teams cache (about 62,000 messages) do work in proportion to what changed. The subtle part is invalidation: a new credential-scrub key, deny term or regular expression must re-read everything, and hashing the rule tables themselves (rather than relying on someone remembering to bump a version) is what makes that safe.

Why an issue, not a PR

Only teamscrawl uses this today, and crawlkit's boundary asks for at least two apps. If another crawler (slacrawl, discrawl, imsgcrawl) would adopt it, we can send a PR from the proven code; say the word.

Activity

  1. added
    P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.
    clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.
    clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.
    clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.
    on Oct 6, 2026
  2. clawsweeper commented on Oct 6, 2026

    @clawsweeper

    Codex review: this still needs some work.

    Summary
    This issue remains unimplemented; repository policy permits closure only for implemented changes, while shared adoption still needs a maintainer decision.

    Reproducibility: Source inspection confirms the requested helper is absent; the reported Teamscrawl resync improvement was not independently exercised.

    Maintainer decision needed

    • Question: Should crawlkit pursue a second adopter before accepting the rules-aware memo API?
    • Recommendation: Defer shared extraction: Retain downstream ownership until another crawler demonstrates matching requirements.
    • Why: The downstream implementation is concrete, but the issue establishes only one consumer and the repository requires demonstrated shared use.

    Next step
    Decide whether to sponsor a second crawler adopter before defining the shared memo API.

    Review details

    Best possible solution:

    Keep the helper downstream until two crawlers establish a compatible signature and comparison contract with app-owned storage.

    Do we have a high-confidence way to reproduce the issue?

    Source inspection confirms the requested helper is absent; the reported Teamscrawl resync improvement was not independently exercised.

    Is this the best way to solve the issue?

    The credited Teamscrawl implementation is a plausible starting point after a second adopter validates the contract, with explicit version bumps still needed for code changes.

    AGENTS.md: found and applied where relevant.

    Remaining risk / open question:

    • No second crawler has demonstrated compatible requirements or committed to adoption.
    • A shared contract still needs supported rule types, code-version invalidation responsibilities, and successful-processing memo persistence semantics.

    Codex review notes: model internal, reasoning medium; reviewed against ca93c9f70a4d.

    Label changes

    Label changes:

    No label changes.

    Label justifications:

    • P3: This optional performance capability establishes no broken crawlkit contract and awaits demonstrated shared adoption.
    Evidence reviewed

    What I checked:

    • Current main and ownership boundary: Checkout HEAD matches GitHub main. The full root AGENTS.md and boundary document require shared mechanics to serve at least two apps; the checkout remained clean. (docs/boundary.md:3, ca93c9f70a4d)
    • Requested behavior is absent: State source, adapters, tests, and package documentation implement cursor storage and elapsed-time freshness. Repository searches found no rules signature or pre-decoding record memo; snapshot fingerprint comparisons and opaque worker revisions serve different contracts. (state/state.go:95, ca93c9f70a4d)
    • Discussion and related scope decision: The issue names Teamscrawl as its sole adopter, and its comments contain no adoption commitment. In Add pure-Go Chromium cache readers (LevelDB, IndexedDB, V8) #156 (comment), steipete declined the separate Chromium-reader extraction pending demonstrated two-app adoption; that decision does not explicitly resolve this issue.
    • Canonical and implementation search: All-state searches for memo, signatures, rules, re-decoding, invalidation, and unchanged records found no replacement owning this capability. The merged feat: process durable background work without pausing ingestion #115 supplies background execution and revision fencing rather than rules hashing. The downloaded Chromium-reader screenshot shows decoding counts, not memo reuse or invalidation. (worker/worker.go:25, ca93c9f70a4d)
    • Feature ownership history: Git history and GitHub commit patches trace the generic cursor store to vincentkoc, its syncstate-to-state rename and legacy adapters to the same author, and mapped-adapter expansion to steipete. Missing local historical blobs were supplemented with GitHub patches. (state/adapters.go:39, 3ff7edef8b33)
    • Credited downstream implementation: The linked MemoSignature hashes decoder and derivation versions plus rule tables; recordDigest combines the signature, database identity, and payload. Its comments explicitly require version bumps for decoder or mapping code changes. This supports the proposed design but does not establish a second adopter or independently verify performance. (internal/teamsdesktop/memo.go:28, ab5e739b4f66)
    How this review workflow works
    • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
    • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
    • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
    • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
    • Maintainers can also comment @clawsweeper review to request a fresh review only.
    • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge; those execution lanes are retired.
    • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

    Reviewed October 19, 2026, 8:01 AM ET / 12:01 UTC.

  3. added
    clawsweeper:intake:featurePreliminary submission classification; full source review pending.
    and removed
    clawsweeper:intake:featurePreliminary submission classification; full source review pending.
    on Oct 16, 2026
  4. 62 remaining items

  5. added
    clawsweeper:intake:featurePreliminary submission classification; full source review pending.
    and removed
    clawsweeper:intake:featurePreliminary submission classification; full source review pending.
    on Oct 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.issue-rating: 🌊 off-meta tidepoolIssue quality rating does not apply to this item.

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions