docs(schema): align agent_ownership / agent_sharing / mcp_api_keys DDL with live schema (#770) - #788
Merged
Merged
Conversation
…L with live schema (#770) Replaces stale DDL blocks in docs/memory/architecture.md to reflect src/backend/db/schema.py's current state. The structural schema fix already landed in #712; this addresses the doc-drift named in #770's Informational section. - agent_ownership: 4 → 25 columns documented (CAPACITY-001, TIMEOUT-001, RES-001, ROLE-001, BACKLOG-001, FILES-001, avatar, voice, guardrails) - agent_sharing: shared_by_id type fixed (TEXT → INTEGER), allow_proactive added - mcp_api_keys: aligned with mcp_keys.py reality (description, key_prefix, last_used_at, usage_count, is_active, agent_name, scope; user_id INTEGER) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Surfaced by /sync-feature-flows audit on PR #788. Same drift class as the architecture.md fix in c8d6741 — agent-sharing.md's embedded DDL was missing the allow_proactive column added by Issue #376's proactive-toggle feature. One-line addition matches schema.py:99-110. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two fixes in the 'Tables' section, surfaced by /sync-feature-flows + /validate-pr audit on PR #788: 1. agent_ownership block now signals truncation explicitly (was implicitly partial — 4 of ~25 columns with no `...` marker, which suggested completeness). Adds caveat pointing to schema.py:67-97 + architecture.md for full DDL. 2. agent_mcp_api_keys block renamed to mcp_api_keys. The agent_mcp_api_keys table does NOT exist — agent-to-agent collaboration uses rows in the single mcp_api_keys table, scoped by `scope='agent'` and `agent_name=<this agent>`. The rename_agent() method at line 334 already correctly uses `mcp_api_keys` — this fixes the inconsistency. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
vybe
approved these changes
May 12, 2026
vybe
left a comment
Contributor
There was a problem hiding this comment.
LGTM — DDL blocks verified against schema.py, clean docs-only change. Merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Doc-only follow-up to #770. Aligns stale DDL blocks in
docs/memory/to reflectsrc/backend/db/schema.py's current state. No code changes, no schema changes, no migrations.The structural schema fix already shipped in #712 (
fix(schema): backfill schema.py to match migrations.py reality, merged 2026-05-08). Every "Critical" finding from the scheduled/validate-schemareport attached to #770 was already resolved by that PR — verified bytests/unit/test_schema_parity.py(4/4 PASS inorigin/dev).What this PR changes
docs/memory/architecture.md, three DDL blocks:agent_ownershipowner_id TEXT,agent_name TEXT PRIMARY KEYidAUTOINCREMENT,agent_name UNIQUE,owner_id INTEGER)agent_sharingshared_by_id TEXT NOT NULL; missingallow_proactiveshared_by_id INTEGER NOT NULL;allow_proactiveaddedmcp_api_keyslast_used,use_count), wrong type (user_id TEXT); missingdescription,key_prefix,is_active,agent_name,scopeschema.py:115-131docs/memory/feature-flows/agent-sharing.md(added in commitd220ee26after/sync-feature-flowsaudit):agent_sharingallow_proactivecolumnallow_proactive INTEGER DEFAULT 0addedDDL is descriptive, not byte-exact:
CREATE TABLE, schema.py usesCREATE TABLE IF NOT EXISTS.-- CAPACITY-001,-- #311,-- proactive-toggle (Issue #376)) for human readers — these don't exist inschema.py.Explicit scope-callout
This PR fixes 3 DDL blocks in
architecture.md(named in #770's Informational section) plus 1 sibling DDL block infeature-flows/agent-sharing.mdsurfaced by/sync-feature-flows. 27 other tables inarchitecture.mdalso lack DDL blocks compared toschema.py— out of scope, tracked at #787.Also out of scope (deferred to follow-up issues):
feature-flows/agent-lifecycle.mdreferences a non-existent tableagent_mcp_api_keys. Fix requires prose+DDL coordination, not a one-line edit. Will be filed as its own doc-bug issue.feature-flows/autonomy-mode.mdshows a partial 10-columnagent_ownershipDDL — verified intentional (autonomy-scoped); the 10 columns matchschema.pyexactly.Follow-ups
Abilityai/trinity, P3) — Decide DDL duplication strategy: keeparchitecture.mdDDL, link toschema.py, or auto-generate. This PR reinforces duplication; Decide DDL duplication strategy: keep architecture.md DDL or link to schema.py #786 is where the long-term call gets made.Abilityai/trinity, P3) — Doc completeness for the remaining 27 undocumented tables. Blocked on Decide DDL duplication strategy: keep architecture.md DDL or link to schema.py #786./validate-schemaskill so it stops auto-filingpriority-p1issues for non-issues. The validator runs on a remote Trinity agent and the skill source lives inabilityai/abilities, so this can't be patched inabilityai/trinity.A courtesy ping to the
vyberemote agent owner (to pause the scheduled run while abilities#2 is open) is in the closing comment on #770.Verification
Visual diff of every updated block against
schema.pylines 67-97 / 99-110 / 115-131 — every column name, type, default, and FK matches (modulo intentionalCREATE TABLEvsCREATE TABLE IF NOT EXISTSand retained--annotations).Closes
Closes #770 — the structural fix shipped in #712; this PR addresses the named doc drift plus one sibling drift surfaced by
/sync-feature-flows.