Repository navigation
Community integration: Pre-send PII sanitizer + dynamic models.json context sizing for local 27B runs #12530
ccancellieri
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Context
While running
3.48Mlocal coding tokens inpiagainst UnslothQwen3.5-9BandQwen3.8-27Bmodels on a 16 GB MacBook Pro, we ran into two practical sharp edges:32KcontextWindowentries in~/.pi/agent/models.jsoncan clampmax_tokensdown to1(stopReason: "length") once prompts approachCONTEXT_SAFETY_TOKENS=4096..pdf,.docx,.xlsx, or log files to remote sessions risks leaking author metadata, emails, IBANs, or tokens unless scrubbed before dispatch.Solution (
ccancellieri/cortical)We built an open-source, zero-dependency Python 3.10+ stdlib companion (ccancellieri/cortical,
Apache-2.0) that syncs cleanly withpi(cortical sync --dry-runand--rollbacksupported):models.jsonsync: Computes safe KV-cache headroom (65,536context in9.08 GiBMetal VRAM for27B UD-IQ2_XXS,98,304for9B UD-Q3_K_XL,reasoning_effort: "none") sopinever hitsmax_tokens=1truncation or300sthinking stalls.cortical-intercept.ts+ MCP): Scrubs Office/PDF metadata and PII offline (0local LLM required for Tier 1), compresses JSON payloads by78%(TOON), and adds a one-shot127.0.0.1:0browser elicitor (cortical next/cortical colleague).~/.pi/agent/sessions/**/*.jsonloffline to report local vs cloud token savings (cortical roi).Sharing in case other local-first
piusers find it helpful; feedback welcome!All reactions