Skip to content

Let the owner delegate marking PII columns to the agent - #12

Merged
tmphost-dev merged 2 commits into
mainfrom
feat/agent-marks-pii
Oct 24, 2026
Merged

tmphost-dev merged 2 commits into
mainfrom
feat/agent-marks-pii

Conversation

@tmphost-dev

Copy link
Copy Markdown
Contributor

What

A per-database switch, Let the agent mark PII columns, on the PII columns tab. When it is on, the MCP sql tool offers a markPii {table, schema?, columns} action. An agent can add PII marks but never remove one: only the owner can uncheck a column.

Light Dark
light dark

How

  • databases.agent_marks_pii (off by default, added by auto-migration), exposed as agentMarksPii on Database and set with PUT /databases/:id/pii/agent.
  • crud.AgentMarkPII only inserts (ON CONFLICT DO NOTHING). Every column must exist in the live schema, matched case-insensitively and stored under its real name. A table name that exists in two schemas needs schema. The set is capped at the existing 10,000 limit. The flag is read from the database on every call, so turning it off stops an agent at once.
  • MCP: when the switch is on, the tool description, the help text and the server instructions offer markPii, and the instructions tell the agent to mark the personal data it finds. The tool's ReadOnlyHint becomes false, because it changes the PII set (it never writes to the database itself). The answer is TOON: table, marked, then columns[N]{name,pii}, where pii is marked or already.
  • PII editor: a save now applies the editor's own checks and unchecks onto the server's latest set, so it doesn't drop columns the agent marked while the editor was open.
  • Fix: PII columns are inserted in batches of 1,000. Saving the documented maximum of 10,000 failed on SQLite with "too many SQL variables".
  • Docs: docs/API.md, README, and an AGENTS.md rule: never give MCP a way to unmark a column.

Tests

  • crud: off by default, owner-only toggle, only adds, dedupes, unknown table or column, ambiguous schema, schema errors, store failures, the cap.
  • mcpserver: markPii is offered only when allowed, the TOON output, payload errors.
  • app_test: the whole flow over HTTP and MCP.
  • vitest: the switch, merging onto the latest set, the api call.
  • make lint is clean and make cover BASE=main passes (every added line covered).

🤖 Generated with Claude Code

tmphost-dev and others added 2 commits October 24, 2026 01:24
A database's agentMarksPii setting (PUT /databases/:id/pii/agent, a switch
on the PII columns tab) offers the MCP tool a markPii action. It only adds:
every column must exist, a marked column stays marked, and only the owner
can unmark one. The setting is checked on every call.

The PII editor now saves its changes onto the server's latest set, so a
save doesn't drop columns the agent marked while it was open.

PII columns are inserted in batches: the documented maximum of 10000 hit
SQLite's bound-variable limit in one INSERT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tmphost-dev
tmphost-dev merged commit 53d11fc into main Oct 24, 2026
6 checks passed
@tmphost-dev
tmphost-dev deleted the feat/agent-marks-pii branch October 24, 2026 01:31
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.

1 participant