Design and implement per-user tenancy #10

Closed
opened 2026-04-03 11:12:38 +00:00 by sam · 3 comments
Member

Summary

Add a tenancy model so AMCS can safely separate data by user, tenant, or workspace instead of assuming a single shared memory space.

Why

Per-user tenancy is listed as a deferred feature in the implementation plan. It becomes important if AMCS is used by multiple users, agents, or client applications that should not share the same thought/project namespace.

Scope ideas

  • Define the tenant boundary: user, org, workspace, or account
  • Add tenant-aware schema and indexing strategy
  • Update auth context so requests resolve to a tenant
  • Ensure searches, project lookups, files, skills, and guardrails are tenant-scoped
  • Consider migration strategy for single-tenant installs
  • Document security expectations and isolation guarantees

Acceptance criteria

  • Requests are scoped to a tenant boundary
  • Data access across tenants is prevented by design
  • Core tools behave correctly in a multi-tenant environment
  • Migration and config approach is documented

Source

Deferred feature from llm/plan.md: per-user tenancy.

## Summary Add a tenancy model so AMCS can safely separate data by user, tenant, or workspace instead of assuming a single shared memory space. ## Why Per-user tenancy is listed as a deferred feature in the implementation plan. It becomes important if AMCS is used by multiple users, agents, or client applications that should not share the same thought/project namespace. ## Scope ideas - Define the tenant boundary: user, org, workspace, or account - Add tenant-aware schema and indexing strategy - Update auth context so requests resolve to a tenant - Ensure searches, project lookups, files, skills, and guardrails are tenant-scoped - Consider migration strategy for single-tenant installs - Document security expectations and isolation guarantees ## Acceptance criteria - Requests are scoped to a tenant boundary - Data access across tenants is prevented by design - Core tools behave correctly in a multi-tenant environment - Migration and config approach is documented ## Source Deferred feature from `llm/plan.md`: per-user tenancy.
Member

Implemented on branch issue-10-per-user-tenancy and opened PR: git.warky[.]dev/wdevs/amcs/pulls/40

Commit: 4b3f0b1b55

Verification:

  • make test passed
  • make build passed

Summary:

  • Auth middleware now propagates API key/OAuth client id as an opaque tenant context.
  • Added tenant_key schema/migration for projects, thoughts, files, learnings, plans, and chat histories.
  • Tenant-scoped project lookup/list/touch, thought CRUD/search/stats, and stored file create/read/list.
  • Added middleware unit test for tenant context propagation.
Implemented on branch `issue-10-per-user-tenancy` and opened PR: git.warky[.]dev/wdevs/amcs/pulls/40 Commit: 4b3f0b1b5526d1e228ba8f21cd7e2da94d4dbf45 Verification: - `make test` passed - `make build` passed Summary: - Auth middleware now propagates API key/OAuth client id as an opaque tenant context. - Added tenant_key schema/migration for projects, thoughts, files, learnings, plans, and chat histories. - Tenant-scoped project lookup/list/touch, thought CRUD/search/stats, and stored file create/read/list. - Added middleware unit test for tenant context propagation.
Member

CI repair pushed for PR #40.

Branch: issue-10-per-user-tenancy
Commit: e3a4a3c5c7
PR: git.warky[.]dev/wdevs/amcs/pulls/40
Verification:

  • Local make test: passed
  • Local make build: passed
  • Gitea Actions PR run 805: success

Root cause: CI ran go test before building embedded Svelte UI assets, so internal/app/ui_assets.go failed on missing ui/dist. The workflow now builds UI assets before Go tests. Also aligned tenancy DBML/migration metadata for tenant_key on future-scoped tables and dropped the old global project-name unique constraint during migration.

CI repair pushed for PR #40. Branch: issue-10-per-user-tenancy Commit: e3a4a3c5c7c98ed280ffdc91175c274f1aadb3f2 PR: git.warky[.]dev/wdevs/amcs/pulls/40 Verification: - Local make test: passed - Local make build: passed - Gitea Actions PR run 805: success Root cause: CI ran go test before building embedded Svelte UI assets, so internal/app/ui_assets.go failed on missing ui/dist. The workflow now builds UI assets before Go tests. Also aligned tenancy DBML/migration metadata for tenant_key on future-scoped tables and dropped the old global project-name unique constraint during migration.
Member

Added the requested tenancy design plan to PR #40.

Branch: issue-10-per-user-tenancy
Commit: cd010fc7a1
Plan: docs/per-user-tenancy-plan.md

Verification:

  • make test: passed
  • make build: passed

The plan covers tenant identity source, schema/model changes, query scoping, migration/backfill, authorization checks, affected backend/API/UI surfaces, test cases, assumptions, and blockers.

Added the requested tenancy design plan to PR #40. Branch: issue-10-per-user-tenancy Commit: cd010fc7a166e71ef60e2d88531079022c7424a0 Plan: docs/per-user-tenancy-plan.md Verification: - make test: passed - make build: passed The plan covers tenant identity source, schema/model changes, query scoping, migration/backfill, authorization checks, affected backend/API/UI surfaces, test cases, assumptions, and blockers.
Sign in to join this conversation.