Skip to content

Document data flows and add per-stage cloud controls (#21) - #34

Open
1aifanatic wants to merge 2 commits into
scaledown-team:mainfrom
1aifanatic:feat/data-flow-controls
Open

1aifanatic wants to merge 2 commits into
scaledown-team:mainfrom
1aifanatic:feat/data-flow-controls

Conversation

@1aifanatic

Copy link
Copy Markdown

Closes #21

Stacked on #33. This branch includes #33's commit (the hook output contract). #33 removes prompt compression, so classification is the only path that sends prompts, and that's what the controls here assume. Review #33 first; once it merges, this diff shrinks to the second commit (Document data flows and add per-stage cloud controls).

Controls

Each one is independent, and the defaults are unchanged:

Variable Effect
SCALEDOWN_CLASSIFY_DISABLE=true UserPromptSubmit skips classification, so the prompt is never sent. Tool-output compression and the proxy keep working.
SCALEDOWN_POST_TOOL_LOCAL_ONLY=true PostToolUse keeps the zero-latency ls/grep/git structural filter and never sends tool output.
SCALEDOWN_LOCAL_ONLY=true No Scaledown requests at all: it implies the two settings above plus SCALEDOWN_PROXY_DISABLE, and no API key is required.
SCALEDOWN_POST_TOOL_DISABLE, SCALEDOWN_PROXY_DISABLE Existing settings, now documented alongside the new ones.

Plus dietcode clear-cache, which deletes ~/.scaledown/proxy (running summaries) and ~/.scaledown/proxy-cache (stashed originals for sd_retrieve). It leaves the config and stats alone. uninstall now mentions it.

Docs: new README section "Data flows & privacy"

  • A table covering each stage: when it fires, what is sent (full prompt, tool output including file contents, older turns as both flattened text and structured blocks), the endpoint, and the switch that turns it off. It also covers the one-off test classify call during setup.
  • What stays local (filters, progress bar, sd_retrieve), the proxy's upstream, and the status line's npm registry update check.
  • Local-only mode.
  • A local storage table with retention: the proxy files have no automatic expiry, and the table says so.
  • Service terms: I couldn't find a published privacy policy, terms or data-retention/training statement at scaledown.ai or docs.scaledown.ai (/privacy and /terms return 404, and neither site links to any). The README says that plainly and asks maintainers to add the links. I didn't invent any policy text.
  • The env var table gains SCALEDOWN_BASE_URL and the three new variables.

Tests (the acceptance checks)

  • hooks/hook-contract.test.ts (built hooks; temporary HOME; stub Scaledown API that records every request):
    • classify disabled: zero requests, and tool compression still calls /compress/raw/;
    • post-tool local-only: a large output makes zero requests and stays unchanged, while ls output is still filtered;
    • SCALEDOWN_LOCAL_ONLY with no API key: zero requests from either hook, and local filtering still applied.
  • New src/local-only.test.ts (os.homedir mocked to a temp dir):
    • config defaults and independence;
    • local-only needs no key;
    • proxy control vs local-only: the same request is summarized normally, but in local-only mode it's forwarded byte-for-byte unchanged with zero summarize calls;
    • clearProxyStore removes only the proxy files.
  • Both suites are in npm run test:unit. tsc --noEmit is clean. The 87 tests across the hook, local-only and niah suites pass. src/client.test.ts still fails with the pre-existing jest is not defined error that fix: restore ESM test execution and cover proxy tests in CI #26 fixes.
  • Manual check: HOME=<tmp> node dist/bin/setup.js clear-cache removed both proxy dirs and kept stats.json.

Not done

  • No automatic retention or expiry for the proxy cache. Maintainers should decide whether the cache should expire automatically; clear-cache is the manual option for now.
  • The service's actual retention and training practices can't be verified from the client side.

🤖 Generated with Claude Code

1aifanatic and others added 2 commits October 26, 2026 09:53
PostToolUse now emits replacements as hookSpecificOutput.updatedToolOutput
in the tool's own shape (Bash stdout with stderr/interrupted kept, Read
file.content with metadata kept) instead of a top-level tool_response that
Claude Code ignores. Bash and Read results now actually reach the filter and
compression path. Savings are booked only after a replacement is emitted.

UserPromptSubmit cannot replace the prompt, so it now emits only the intent
hint as hookSpecificOutput.additionalContext and no longer calls compress or
books prompt-compression savings that never reached the model.

Adds subprocess contract tests for the built hooks (temporary HOME, stub
Scaledown API) and updates README/setup/AGENTS.md claims.

Refs scaledown-team#15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- SCALEDOWN_CLASSIFY_DISABLE: skip per-prompt classification (prompts are
  never sent) without affecting tool-output compression or the proxy.
- SCALEDOWN_POST_TOOL_LOCAL_ONLY: keep only the local ls/grep/git structural
  filter; tool output is never sent.
- SCALEDOWN_LOCAL_ONLY: no Scaledown requests from hooks or the proxy and no
  API key required (implies the above plus SCALEDOWN_PROXY_DISABLE).
- `dietcode clear-cache` removes ~/.scaledown/proxy and proxy-cache only.

README gains a "Data flows & privacy" section: what each stage sends, when,
to which endpoint, the switch for each, what is persisted locally and its
retention, and a note that no service privacy/retention terms were found.

Tests assert disabled stages make no requests (built hooks against a stub
API with a temporary HOME; proxy with a counting client) and that local-only
forwards proxy requests unchanged.

Refs scaledown-team#21

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Document external data flows and provide per-stage controls for cloud processing

1 participant