[RFC] Enterprise multi-tenant, rank, and project governance
RFC: Enterprise Multi-Tenant, Rank, and Project Governance for OpenViking
| Field | Value |
|---|---|
| Status | Draft |
| Date | 2026-11-20 |
| Author | zuoanCo |
| Area | Account/user identity, groups, ACL, resources, retrieval, skills, tasks |
| Related docs | docs/en/concepts/11-multi-tenant.md, docs/en/concepts/15-acl.md, docs/en/api/12-acl.md |
| Related issues | #1351, #5277, #6377, #7538, #7839, #8049 |
| Validation baseline | OpenViking v0.5.5, self-hosted instance |
Public-safe case study. Personal identifiers, API keys, internal hostnames, and business content are intentionally omitted.
1. Summary
OpenViking already provides the core primitives needed for enterprise multi-tenancy:
account_idas the outer tenant boundary;user_idas the private memory/session boundary;- groups and ACL entries for shared resources;
read,write, andmanagelevels;- retrieval filtering that follows account and ACL boundaries;
- skills, compile tasks, watches, and sessions inside the same identity model.
What is still missing is a documented and reproducible enterprise governance model that answers:
- How should an organization's existing identity and authorization system map into OpenViking accounts, users, ranks, projects, and ACLs?
- How should tenant and project changes be reconciled idempotently without resetting keys or rewriting unrelated resources?
- How can maintainers validate that the resulting permission model is correct and does not leak across tenants, projects, users, or sessions?
This RFC proposes a reference architecture, desired-state reconciliation model, onboarding workflow, and conformance test design. It does not require new storage semantics in the first iteration. The initial deliverable can be documentation plus a reference validation kit; a first-class desired-state API can be considered after maintainer feedback.
2. Motivation
Real enterprise deployments usually have four independent authorization layers:
Organization membership
-> functional role/permission system
-> project membership and project role
-> resource-level read/write/manage ownership
OpenViking currently exposes the last layer well, but operators still have to design the first three manually. In practice this creates recurring problems:
- account, tenant, group, and user terminology is easy to mix;
- rank-like roles are often modeled as flat ACL entries with no lifecycle;
- a project role and a tenant-wide role can conflict if they are not separated;
- external identity changes are applied by ad-hoc scripts that are not idempotent;
- write access and delete/manage access are sometimes confused;
- administrators bypass ACLs and therefore can mask an ordinary user's permission regression;
- cross-tenant and cross-project negative tests are often incomplete;
- test data is not always isolated from production resources.
The proposal addresses these issues with a stable mapping and a repeatable validation method.
3. Current Baseline
3.1 Existing OpenViking contract
The proposal relies on documented behavior:
- Account is the tenant boundary.
- User memory, sessions, and private resources are user-scoped.
- Shared resources may use group or user ACLs within one account.
restrictednodes use direct grants only.manageincludes delete, move, and ACL administration.- Account ADMIN has implicit
manageon shared resources. - ACL applies only to
viking://resources/....
3.2 Deployment modes
Two deployment modes are valid:
| Mode | Tenant identity | Isolation | Recommended use |
|---|---|---|---|
| Namespace mode | One account, tenant prefix under resources/ |
ACL + path policy | Migration, small internal deployments |
| Dedicated-account mode | One account per tenant | Native account boundary + ACL | Production enterprise deployment |
The same logical model should work in both modes so that migrations do not require redesigning groups or project paths.
3.3 Non-goals
This RFC does not:
- replace the existing account/user/ACL implementation;
- define participant-level ACL inside a session;
- define a new retrieval ranking algorithm;
- prescribe one external identity provider;
- publish production business content;
- change real user roles or API keys during validation;
- define a DAG scheduler inside OpenViking.
4. Proposed Governance Model
4.1 Four-layer model
Tenant
-> Rank group
-> Project group
-> Project role group
-> Resource ACL
| Layer | Example | Purpose |
|---|---|---|
| Tenant | lkker |
Organization/customer boundary |
| Rank | rank_l3_lkker |
Flat organization-wide collaboration level |
| Project | proj_smart_service_lkker |
Project membership boundary |
| Project role | proj_smart_service_lkker__contributor |
Owner/contributor/viewer behavior |
| ACL | group:proj_smart_service_lkker__contributor = write |
Resource decision |
Ranks and project roles are orthogonal:
- rank answers "how much organization-wide collaboration can this user perform?";
- project role answers "what can this user do inside this project?";
- ACL answers "what can this effective identity do on this resource?"
4.2 Tenant and account identity
The external authorization system is the source of truth for organization membership.
organizations.code -> tenant code -> account_id (target mode)
Rules:
- Do not invent tenant identifiers.
- Do not use a person's username as a tenant or group identifier.
- A tenant is created only after the external organization record exists.
- The public logical resource path remains readable:
viking://resources/_enterprise/<tenant>/
- In dedicated-account mode,
account_idprovides native isolation and the path remains stable for tooling. - In namespace mode, the same path is protected with
restrictedACLs at the tenant root and every controlled descendant.
4.3 Rank model
A flat L1-L6 model is easier to operate than copying an external role system one-to-one.
| Rank | Typical responsibility | Tenant root | Shared | Review | Org metadata | Admin role |
|---|---|---|---|---|---|---|
| L1 member | Read and personal work | read | read | none | none | user |
| L2 specialist | Create shared assets | read | write | read | none | user |
| L3 lead | Review and coordinate | read | write | write | read | user |
| L4 manager | Own team metadata | read | write | write | write | user |
| L5 administrator | Manage members and config | manage | write | write | manage | admin |
| L6 super administrator | Tenant-wide recovery | manage | manage | manage | manage | admin |
The rank mapping should be explicit and versioned:
{
"super_admin": "L6",
"admin": "L5",
"operations": "L4",
"regional_lead": "L3",
"design_lead": "L3",
"designer": "L2",
"member": "L1"
}
External permission-point systems remain authoritative for application features. Rank mapping is only for resource collaboration in OpenViking.
4.4 Project role model
| Project role | Overview | Knowledge | Memory | Deliverables | Project meta |
|---|---|---|---|---|---|
| viewer | read | read | none | none | none |
| contributor | read | write | write | read | none |
| owner | manage | write | write | write | manage |
Project ACLs are recomputed as a complete desired set after membership changes. Incremental mutation is allowed through grant/revoke APIs, but reconciliation should converge to the complete set.
4.5 Resource skeleton
viking://resources/_enterprise/<tenant>/
├── README.md
├── meta/
│ ├── tenant.md
│ ├── members.md
│ └── projects.md
├── shared/
├── review/
├── org-memory/
│ ├── policies/
│ └── decisions/
└── projects/
└── <project>/
├── overview/
├── knowledge/
├── memory/
├── deliverables/
└── meta/
Rules:
- Create directories and directory indexes before applying ACLs.
- Set the tenant root and controlled descendants to
restricted. - Use groups, not individual users, for normal project and rank grants.
- Keep personal memory and sessions out of shared resources.
- Keep process memory separate from published deliverables.
5. Desired-State Reconciliation
5.1 Contract
A synchronizer reads authoritative organization, rank, and project membership data and produces a desired-state document.
{
"tenant": "lkker",
"account_mode": "dedicated",
"ranks": {
"platform_admin": "L6",
"product_owner": "L5",
"researcher": "L2"
},
"projects": [
{
"id": "smart-service",
"owner": "platform_admin",
"contributors": ["product_owner", "researcher"],
"viewers": []
}
]
}
The actual document should use stable external user IDs. The example uses role labels only to avoid publishing personal identifiers.
5.2 Reconciliation algorithm
1. Validate tenant code against the authoritative organization record.
2. Read users and active organization memberships.
3. Ensure tenant, rank, project, and project-role groups exist.
4. Normalize group membership to the desired set.
5. Ensure resource directories and directory indexes exist.
6. Compute tenant, domain, project, and project-subdomain ACLs.
7. Apply ACLs as full desired sets.
8. Verify effective access with both positive and negative probes.
9. Record an operation id, diff summary, retry count, and rollback point.
5.3 Idempotency rules
- Repeated reconciliation produces the same result.
- Existing user API keys are never reset by membership reconciliation.
- Removing a user from a project does not delete history or audit records.
- Disabling a user removes group membership but preserves attributed content.
- ACL writes converge to a complete set and do not accumulate stale grants.
- A failed reconciliation never falls back to broader access.
- Unknown external roles fail closed or are mapped to a documented least-privilege rank.
5.4 Authorization evaluation order
1. Resolve account and trusted identity.
2. Resolve the user's group IDs.
3. Build effective ACL for the target resource.
4. Apply restricted/inherit semantics.
5. Evaluate read/write/manage for the requested operation.
6. Apply the same effective identity to retrieval and listing.
7. Do not let administrative bypass hide a normal-user regression.
6. Reference Case Study
The design was exercised against a design-services organization with three project types:
| Project | Main content | Permission-sensitive behavior |
|---|---|---|
smart-service |
support knowledge, prompts, evaluations, release notes | contributors maintain knowledge and process memory; viewers only read published knowledge |
knowledge-base |
domain ontology, FAQs, source registry, retrieval evaluations | viewers see published knowledge only; owners control evaluation and ACL |
website-v3 |
information architecture, brand guidance, review notes, release deliverables | contributors write knowledge and memory; owners manage deliverables and project metadata |
The case study intentionally uses real organization and project names but omits personal identifiers, credentials, and business payloads.
7. Working Method
7.1 Onboarding sequence
organization record
-> tenant/account decision
-> rank groups
-> project groups
-> resource skeleton and indexes
-> ACL computation
-> positive/negative validation
-> audit record and rollback point
7.2 Test-data separation
Production and validation are separate:
production: viking://resources/_enterprise/lkker/
validation: viking://resources/_enterprise/lkker-validation/
Validation users use a dedicated prefix. Production users are read-only baseline subjects and are never modified.
7.3 ACL-before-test invariant
The order must be:
mkdir
-> ensure directory index
-> set ACL
-> run permission probes
Applying ACL before the context record exists makes the result unreliable.
7.4 Evidence chain
request/response
-> per-case JSONL
-> summary JSON
-> performance JSON
-> human-readable report
-> cleanup and zero-residue check
8. Validation Design
The reference validation kit covered 16 modules:
| Module | Focus |
|---|---|
| A | Environment and immutable baseline |
| B | Data readiness |
| C | Account/user identity and role administration |
| D | Group lifecycle and membership |
| E | Cross-tenant isolation |
| F | Rank matrix |
| G | Project-role matrix |
| H | Privilege escalation and horizontal access |
| I | Resource lifecycle and path boundaries |
| J | Retrieval isolation |
| K | Skill visibility and lifecycle |
| L | Compile, task, and watch authorization |
| M | Session and private-memory isolation |
| N | Administrative surfaces |
| O | Idempotency, malformed input, encoding, concurrency |
| P | Lightweight performance baseline |
8.1 Matrix calculation
rank read = granted level in {read, write, manage}
rank write = granted level in {write, manage}
project read = granted level in {read, write, manage}
project write = granted level in {write, manage}
The matrix is derived from the same desired-state document that creates the groups and ACLs.
8.2 Negative-test requirements
- tenant A cannot read or write tenant B;
- project A member cannot access project B memory;
- outsider cannot retrieve either tenant's marker;
- write cannot mutate ACL or delete;
- non-admin cannot call account, group, or role administration;
- unknown skill, session, task, and watch identifiers return bounded errors;
- path traversal and invalid principals are rejected;
- administrative bypass is reported separately and never used as evidence that a normal user passed.
9. Validation Results
Baseline: self-hosted OpenViking v0.5.5, isolated validation tenant and users, with the production tenant left unchanged.
| Metric | Result |
|---|---|
| Total cases | 305 |
| PASS | 271 |
| FAIL | 0 |
| OBSERVE | 34 |
| BLOCKED | 0 |
| Non-failure rate | 100% |
Key outcomes:
- cross-tenant read, write, and retrieval isolation passed;
- rank matrix passed 60/60;
- project-role matrix passed 90/90;
- no privilege escalation or ACL mutation was found with a normal user;
- no path traversal or cross-tenant retrieval leak was observed;
- production users and the production tenant were unchanged;
- validation users, groups, and resource roots were removed after evidence capture.
Performance baseline on the self-hosted instance:
| Operation | Observed |
|---|---|
| list | 24 ms |
| read | 21 ms |
| write | 34 ms |
| retrieval | 186 ms |
| ACL query | 16 ms |
| 20 concurrent reads | 20/20 succeeded |
The results are a point-in-time baseline, not a capacity or regression guarantee.
10. Observations and Open Risks
The 34 OBSERVE entries were not counted as failures. The main themes were:
- Whether dashboard/observer information should be visible to ordinary users.
- The intended ownership check for cross-user session message writes.
- Whether
manageshould remain mandatory for delete and move. - Which skill roots should be writable by ordinary users and how visibility is determined.
- Compile/watch observability and task ownership boundaries.
- Retrieval
recallbehavior across users and index freshness. - URI length, filename length, empty content, and query-length limits.
- Error-code consistency for invalid principals, modes, and malformed requests.
- Same-name project ordering and cross-tenant retrieval edge cases.
- Administrative endpoints that are readable but may expose unnecessary information.
These should be confirmed against current upstream behavior before they are treated as product requirements.
11. Compatibility, Security, and Rollout
11.1 Compatibility
- Namespace mode preserves the current single-account deployment model.
- Dedicated-account mode uses existing account semantics and does not require a new storage format.
- Existing user keys remain valid during membership reconciliation.
- ACL changes are additive to the current API surface; no existing ACL field needs to be reinterpreted.
11.2 Security
- The synchronization service must use least-privilege credentials.
- ROOT credentials must not be used for normal application traffic.
- API keys must never appear in reports or logs.
- Administrative bypass must be explicitly labeled in test results.
- Cross-tenant negative tests must run before rollout.
- Public case studies must omit personal identifiers and business payloads.
11.3 Migration sequence
1. Inventory real organizations and projects.
2. Choose namespace or dedicated-account mode.
3. Create a desired-state document.
4. Run in dry-run mode and publish the diff.
5. Apply groups and resource skeleton.
6. Apply ACLs and run negative tests.
7. Enable normal traffic.
8. Keep a read-only rollback point.
12. Acceptance Criteria
A deployment conforms to this RFC when:
- Every tenant maps to an authoritative organization record.
- Every controlled resource has a documented rank/project ACL source.
- Idempotent reconciliation produces no unintended change on a second run.
- A normal user cannot read or write another tenant.
- Project roles cannot cross project boundaries.
writecannot performmanage-only operations.- Retrieval and filesystem listing agree on visibility.
- Production users and keys are unchanged by validation.
- Evidence is complete enough to replay every failed case.
- Cleanup leaves zero validation users, groups, and resource roots.
13. Open Questions
- Should this become an official OpenViking reference architecture under
docs/, or remain a community RFC? - Should the project expose a first-class desired-state reconciliation API/CLI, or is a reference script the preferred first step?
- Which maintainers should review account/identity mapping and ACL lifecycle?
- Should rank and project-role conventions live in core docs, examples, or a separate deploy template?
- How should the project represent future organization hierarchies without making group membership recursive?
- Should standard conformance fixtures be added to
tests/or kept as deployment examples? - Can the observations above be converted into explicit contract tests for current upstream behavior?
14. Related Work
- Account/user/agent namespace policy: #1351
- Path-scoped tenant connections: #5277
- Configurable resources-root ACL: #6377
- Shared-skill write authorization: #7538
- Explicit tenant admin delegation: #7839
- Cross-account ACL behavior: #8049
15. Contribution
I am willing to contribute:
- the RFC follow-up as documentation;
- a reference desired-state schema;
- curl/CLI examples;
- a sanitized conformance fixture;
- focused tests for any maintainer-approved contract.