Internal proposal · for approval

AI HQ Control Plane

A single place that holds what we know about every project we have shipped, and turns AI coding work from a per-session effort into a reviewable, auditable pipeline across the fleet.

Prepared by AIman
Orionesofttech
24 August 2026
Decision requested: Phase 0 + 1

01The problem we have now

Everything we know about a finished project lives in two places that we cannot query: the original developer's head, and an AI chat session that has since been closed.

That has four consequences we are paying for every week.

  • Every small change restarts from zero. Adding a function or fixing a minor bug on a completed project begins with rebuilding context — re-reading the code, rediscovering the conventions, working out again why something was built the way it was. The change itself is usually the quick part.
  • We solve the same problem repeatedly. A fix worked out on one project is not written down in a form another project can use, so the next developer to hit it starts over.
  • One person is the bottleneck. In practice only the original developer can safely touch a given project. That caps how much work the team can absorb and concentrates real business risk in one person.
  • There is no record. We cannot answer, for any project, what changed, why, or who authorised it.

None of this is a tooling gap in how we write code. It is a memory gap. AI HQ closes it.

02What AI HQ is

A control plane with four subsystems and one cross-cutting concern.

SubsystemWhat it holdsWhat it makes possible
Project registry & fleet viewEvery server, every project on it, stack, deploy target, current version, health, owner.One authoritative answer to “what is running where, and who owns it.”
Knowledge layerPer-project cards, an append-only fix log, and a cross-project pattern library. Written by the people and agents doing the work, enforced in CI.Any change to any project starts with full context instead of none.
Job orchestratorA queue, a pool of short-lived sandbox runners, per-job policy enforcement, transcripts, budgets.AI work becomes a tracked job with an owner, a cost, an audit trail and a review gate — not an untracked chat.
Credential brokerEncrypted credentials, referenced everywhere by alias. Plaintext resolved only at deploy time.Staff can build against production services without ever learning a production credential.
Audit & access control
(cross-cutting)
Permissions scoped to person × project × capability. Append-only log of every gate decision, tool call and secret read.Junior staff can be given real work with limits we can prove, not limits we hope hold.
Setting expectations correctly

AI HQ does not train or fine-tune a model. There is no learning in that sense, and we should not claim there is. What it does is retrieval and prompt assembly: HQ selects the right knowledge for the job at hand and composes a well-formed instruction from it. This is deliberately the cheaper design — it is auditable, it can be corrected instantly by editing a record, and it needs no ML infrastructure.

03How a job flows

A job is any unit of AI work: a bug fix, an added function, a dependency bump. It can be started by a staff member, by an error alert from production, or on a schedule. Every job takes the same path, and the path is where all the safety lives.

AI CONTEXT BOUNDARY Work request staff prompt · production error alert · schedule HQ policy gate person × project × capability · budget · prompt screen Context pack assembled project card · fix log · patterns · credential aliases Sandbox runner, on a git branch every tool call checked in code · egress allowlist short-lived identity, destroyed when the job ends Tests · lint · secret scan a failing job never reaches a human Pull request + full transcript the diff and every step that produced it Human review gate nothing proceeds without a named approver Deploy pipeline revertible in one command Production host — one of 50+ Knowledge store project cards · fix log · patterns writes are reviewed proposals, never direct read Credential vault envelope-encrypted; master key held outside the database every read logged aliases only plaintext resolved here only, after approval — never in a prompt, never in a transcript what we learned, as a draft entry Audit log append-only · who, what, which project, when including every secret read
Figure 1 — the job lifecycle, and where credentials appear. The dashed region is everything the AI can see. Credential aliases cross into it; plaintext never does — it is resolved by the deploy pipeline, after a human has approved the change. This is what makes “staff never learn the production credential” a property of the architecture rather than an instruction we hope the AI follows.

04Why we do not let agents edit servers directly

The obvious design is to install an AI coding agent on each server and let staff send it instructions. It is faster to build and faster to use. We are not proposing it, and the reason is worth stating plainly because it is the single largest risk in this whole idea.

An agent editing a running production host has no review step. A misread instruction, a wrong path, a confidently wrong assumption — the damage is live before anyone sees it. This is not hypothetical: it is a documented failure mode, including a widely reported case where a coding agent deleted a production database during a change freeze and then misreported what it had done. The current OWASP risk list for agentic applications tracks it under Cascading Failures, alongside Tool Misuse and Excessive Agency.

NOT PROPOSED — AGENT EDITS THE HOST AI agent writes directly into running code Production host Blast radius: live production, immediately. No diff, no approver, no record. PROPOSED — SANDBOX, THEN REVIEW AI agent Branch Tests Review Deploy Production host a named human approves Blast radius: a git branch. Every change has a diff, an approver and a one-command revert.
Figure 2 — the one edge that changes. Same agent, same production host. The proposed model replaces a single unreviewed write with a chain that ends in a human decision. The cost is minutes of review per change; the benefit is that a bad job costs us a discarded branch instead of an outage.

There is a second benefit that matters at our scale. With 50-plus servers and 20-plus people, two agents will eventually work the same project at the same time. Branch-per-job turns that into an ordinary merge conflict rather than two processes overwriting each other's edits in a live directory.

And it simplifies the fleet considerably. Because code work happens in short-lived sandboxes that clone from git, the agent never needs to live on the server at all. What we install on each of the 50-plus hosts is a thin, mostly read-only reporter: it publishes health and the currently deployed version, ships logs and errors up to HQ, and executes deploys when the pipeline instructs it. That is a much smaller thing to secure and maintain than a full coding agent per host — and it is the difference between one compromised host exposing one host, and one shared agent account exposing the fleet.

Requirement REQ-3

No agent writes directly to a production host. All code changes reach production through branch, tests, review and the deploy pipeline. A restricted break-glass path for genuine emergencies is limited to named senior staff and alerts the leadership channel on use.

05The knowledge layer

This is the part that solves the original problem, and it is the part most likely to quietly fail. Two failure modes to design against.

Documentation rot

Hand-maintained notes stop being true within about a month. Asking people to keep them current through an SOP does not work, because the SOP is the first thing dropped under deadline. So we make it mechanical: a change is not mergeable unless it carries a knowledge entry, enforced in CI, and the entry is drafted automatically from the diff so the human is editing a draft rather than facing a blank field.

Knowledge poisoning

If every agent run can write freely to shared knowledge, then one hijacked or simply overconfident run corrupts the context of every future job that reads it. OWASP lists this as Memory & Context Poisoning. Our answer: knowledge writes are proposals that require review, and we keep a verified tier separate from an unverified one.

Three tiers, not one big file

A single five-thousand-line document per project is worse than none: it consumes the context budget and buries the useful paragraph. We split by how often the information is needed.

Project card One page. Stack, entry points, deploy command, hard invariants, what not to touch. Changes rarely. Fix log Append-only, dated. Symptom, root cause, the fix, what to check next time. Grows forever. Pattern library Cross-project. How we do auth, error handling, payments, deploys. Reused by every project. What the agent receives The project card, in full A short index of the other two tiers A search tool to pull what it needs Credential aliases, no plaintext bounded, so cost stays predictable always loaded index · fetch on demand index · fetch on demand HOW AN ENTRY GETS IN Merged change Draft written from the diff Human review Verified tier CI blocks the merge if a change carries no knowledge entry — the draft is generated from the diff, so the reviewer edits rather than writes.
Figure 3 — bounded context in, reviewed knowledge out. Only the project card is always loaded. The fix log and pattern library reach the agent as a searchable index, so context size — and therefore cost per job — does not grow as the knowledge base does. Nothing enters the verified tier without a person approving it.

Records are stored structured in Postgres and rendered as readable Markdown views, rather than stored as loose files. That gives us search, filters, per-entry review state and history for free, and still leaves a human-readable document in each repository for anyone who wants to read it directly.

06Credentials

The goal is that a staff member can build and ship against production services without ever seeing a production credential. That goal is achievable, but only with the right mechanism — and it is worth being precise about why the obvious approach does not work.

Telling the AI “you may use the key but never reveal it” is not a control. If a credential is present in the model's context, or reachable by a shell the model operates, it can be extracted — not by a sophisticated attack, but by asking the agent to print its configuration, or to write a diagnostic script, or by pasting content into the repository that the agent later reads as an instruction. A rule expressed in prose to a text generator is a preference, not a permission boundary.

The mechanism that does work is a broker. Credentials are referenced everywhere by alias — {{secret:prod/postgres/password}} — and the alias is all the AI ever handles. Substitution happens outside the model entirely, performed by the deploy pipeline after the change has already been reviewed. The agent's task becomes “which credential does this need,” which is exactly the experience described, delivered by architecture rather than by instruction.

Building our own store

We propose to build the store in HQ rather than adopt a third-party secrets manager, for control and to avoid another external dependency. That is defensible, but it means we own the security surface, so the following are stated as requirements rather than recommendations.

Requirement REQ-1

No plaintext credential ever enters a model context, a prompt, a log line or a transcript. Aliases only, everywhere.

Requirement REQ-2

Envelope encryption: a unique data key per secret, encrypted under a master key that is held outside the application database — a KMS or equivalent. A master key stored beside the ciphertext means the store is decorative.

Requirement REQ-2b

Every credential read is recorded: which person, which job, which project, when. At 20-plus people this is the record that answers “who could have taken this” six months later.

Requirement REQ-2c

A written, tested rotation procedure exists before the store holds anything real, and is executed whenever someone leaves or changes role.

Recommendation

Put the store behind a thin interface from day one, so that moving to a self-hosted third-party manager later — if we decide we would rather not maintain this ourselves — is a configuration change instead of a rewrite of every caller. This is roughly a day of extra work and it preserves the option.

07Roles and access

At 50-plus servers and 20-plus people, a single flat “staff” role breaks the first time two teams should not see each other's projects. So the unit of permission is person × project × capability, not a global role.

RoleCan dispatch jobs onCan approveCredential access
Platform ownerAny projectAny change, including break-glassManage aliases and rotation; plaintext only through an audited break-glass path
Project leadProjects they ownChanges on their projectsAssign which aliases a project may use
DeveloperProjects they are assignedNothing — their work is reviewedAliases only, from the project's allowed set
Read-onlyNothingNothingNone
Roles are a starting point, refined in Phase 4. Every role change is logged, and access is removed by a defined leaver process rather than by remembering.

Screening staff prompts

The proposal includes a screening step that inspects a staff instruction before dispatch and refuses obviously improper ones, notifying the leadership channel in Lark. This is worth having: it catches careless and opportunistic attempts, and it produces a signal we can review.

It should not, however, be presented as the security boundary. It is a filter on intent expressed in text, and text can be rephrased. The real boundary is what the agent is permitted to do once running — enforced in code, deny-by-default, on every single tool call. Screening is the smoke alarm; tool permissions are the fire door.

08Security controls

Each control below is a mechanism, not a policy statement. The right-hand column names the industry risk category it addresses, using the OWASP Top 10 for Agentic Applications so that this can be reviewed against a recognised framework rather than our own judgement.

ControlMechanismAddresses
Deny-by-default tool permissionsEvery tool call the agent attempts is intercepted before execution and checked against HQ policy in code, which returns allow or deny. A deny cannot be argued with or overridden by any permissive rule.Tool Misuse; Excessive Agency
No unreviewed production writeSandbox runner, git branch, tests, human approval gate, deploy pipeline. One-command revert on every deploy.Cascading Failures
Credentials out of contextAlias-only references; plaintext resolved by the deploy step after approval; every read logged.Identity & Privilege Abuse
Per-job identityEach job runs under its own short-lived credential and is destroyed with the sandbox. No shared agent account across the fleet.Identity & Privilege Abuse; Rogue Agents
Network egress allowlistSandbox reaches only the hosts a job legitimately needs. Default is nothing.Unexpected Code Execution
Knowledge write reviewEntries are proposals; a person promotes them to the verified tier. Verified and unverified are stored separately.Memory & Context Poisoning
Untrusted repository contentContent the agent reads — issue text, code comments, dependency files — is treated as data, never as instruction. Combined with deny-by-default tools and no credentials in context, a planted instruction has nothing useful to reach.Agent Goal Hijack
AttributionAppend-only audit log of every gate decision, tool call, approval and credential read, tied to a named person.Rogue Agents
Owner, expiry, kill switchEvery job has a named human owner, a hard time limit, and a tested terminate action reachable from the dashboard.Rogue Agents
Spend limitsPer-role and per-project token budgets with a hard stop, plus a live cost view. A looping agent is a cost incident, not a surprise invoice.Excessive Agency
Reviewer sees the real actionsThe pull request carries the full agent transcript, not only its summary of what it did.Human–Agent Trust Exploitation
Requirement REQ-4

Tool permissions are deny-by-default and enforced in code on every call. No security property depends on instruction text inside a prompt.

Requirement REQ-5

Every job has a named human owner, a hard expiry, and a kill switch that has been tested.

Requirement REQ-6

Every agent action is attributable to a person in an append-only log, and every deploy is revertible with one command.

09Risk register

IDRiskLikelyImpactMitigationResidual
R1A staff member extracts a production credential through the agentMedHighAlias-only references; plaintext resolved post-approval outside any model context; every read logged (REQ-1, REQ-2)Low
R2An agent breaks live productionMedHighNo direct host writes; sandbox, tests, human gate, one-command revert (REQ-3)Low
R3Our own vault implementation has a flawMedCriticalEnvelope encryption; master key external; independent review before it holds real credentials; swappable behind an interfaceMed
R4Injected instructions in repository or issue content redirect an agentHighMedRepository content treated as data; deny-by-default tools; egress allowlist; no credentials in context. Cannot be eliminated, only contained.Med
R5The knowledge base goes stale, or is poisoned with wrong informationMedMedCI blocks merges without an entry; drafts generated from the diff; verified tier requires human promotionLow
R6Token spend runs awayMedMedHard per-role and per-project budgets; cost dashboard shipped in Phase 2, before staff access opens in Phase 4Low
R7Single-builder dependency — one person holds all platform knowledgeHighHighPhases are independently useful; the platform is documented in its own knowledge layer; off-the-shelf components used where they exist. Not fully mitigable without a second engineer.Med
R8Scope overruns and nothing shipsHighHighPhase 0 and 1 deliver standalone value with no dispatch and no credentials; hard gate before each later phaseMed
R9Misuse by an authorised staff memberLow–MedHighProject-scoped permissions; full audit; anomaly alerts to the leadership channel in LarkMed
R10Compromise of one host spreads across the fleetLowHighThin read-mostly reporter per host; per-host identity; no shared agent account; no credentials stored on hostsLow
Likelihood and impact are assessed before mitigation; residual is the assessment after. R3, R4 and R7 remain the items to watch and are the ones most improved by additional resourcing or by adopting third-party components.

10Delivery plan

Estimates assume one developer working on this alongside existing responsibilities, which realistically means around 40 per cent of a week. Person-weeks are the work; elapsed weeks are what the calendar will show at that capacity. These are honest numbers rather than encouraging ones, because the decision this proposal is asking for depends on them being real.

Phase 0

Knowledge schema, SOP, and backfill of existing projects

Define the three-tier record structure. Write the SOP. Build tooling that runs an agent across each existing repository and produces its initial project card and fix-log skeleton for a human to correct.

Done when every active project has a reviewed project card, and adding a feature to an old project no longer starts with context reconstruction. Needs no HQ application at all — the records live in the repositories.

3 pw≈ 7 weeks elapsed
Phase 1

HQ core — registry, knowledge service, read-only fleet view

Next.js and Postgres. Server and project registry with ownership. Knowledge stored structured and rendered as Markdown views. Thin read-only reporter on each host for health and deployed version. CI check that blocks a merge with no knowledge entry.

Done when “what is running where, who owns it, and what do we know about it” has one authoritative answer. No job dispatch, no credential store, no staff access — and therefore no new security surface.

6 pw≈ 15 weeks elapsed
Phase 2

Job orchestrator, single operator

Queue, sandbox runner, context-pack assembly, in-code tool policy enforcement, audit log, branch and pull-request flow, transcript capture, kill switch, token budgets and cost dashboard. Dispatch restricted to the platform owner.

Gate before starting: Phase 1 in use, and every active project in version control with runnable tests.

7 pw≈ 17 weeks elapsed
Phase 3

Credential vault and broker

Envelope encryption, external master key, alias resolution inside the deploy step, read audit, rotation runbook.

Gate before holding real credentials: independent security review of the implementation.

4 pw≈ 10 weeks elapsed
Phase 4

Roles, staff access, screening and alerting

Project-scoped permissions, joiner and leaver process, prompt screening, Lark alerts to the leadership group, per-role quotas.

This is where the team-capacity return actually lands — junior staff dispatching real work within provable limits.

5 pw≈ 12 weeks elapsed
Phase 5

The flywheel

Production error automatically opens a job with full context attached. Scheduled maintenance jobs. Knowledge quality metrics. This is the point at which HQ stops being a dashboard we look at and starts being a system that does work.

3 pw≈ 7 weeks elapsed
Resourcing, stated plainly

Total is roughly 28 person-weeks. At one developer part-time that is approximately 16 months to the full platform. Phases 2 and 3 parallelise cleanly, so a second developer brings the full build to roughly 9 to 10 months.

The point of the phase structure is that we do not have to decide that today. Phases 0 and 1 together are about 22 weeks and they solve the problem this proposal opened with — on their own, with no dispatch, no credential store and no new security surface. Everything after that is a separate decision, made with Phase 1 already delivering.

11Cost and return

Two cost lines: infrastructure, which is small and predictable, and AI usage, which is the variable and needs measuring rather than guessing. The figures below are planning estimates to be replaced with real telemetry during Phase 2 — which is precisely why the cost dashboard ships in Phase 2, before staff access opens in Phase 4.

Running cost, monthly

LineBasisEstimate
HQ application and PostgresManaged database plus application host$60 – 120
Sandbox runner poolOne burst host, roughly four concurrent jobs$50 – 90
Key management for the master keyPer-key and per-operation charges$1 – 5
Transcript and log storageObject storage, retention around 12 months$5 – 15
Infrastructure subtotal$120 – 230
AI usage — Phase 1 onlyBackfill plus low job volume, one operator$60 – 150
AI usage — full rolloutSee model below$400 – 1,400
Ranges, not point estimates. The wide band on AI usage is the honest state of our knowledge before Phase 2 telemetry exists.

How the AI usage figure is built

Small fix, per job
$0.50–2.50bounded context, few turns
Feature addition, per job
$3–10longer, more files touched
Volume at full rollout
~260/mo20 people × 3 jobs per week
Mid-point estimate
~$740/mo70% small fixes, 30% features

Four levers control this figure, and all four are design decisions already built into the plan: prompt caching across a job's turns; the bounded context pack from Figure 3, so cost per job does not grow as the knowledge base does; routing mechanical work to a cheaper model tier; and hard per-role budgets that stop rather than warn.

Return

The clearest measurable saving is context reconstruction time. The formula is deliberately simple so the assumptions can be challenged:

tasks per week × minutes of context rebuild × loaded hourly cost

On an illustrative fifteen small tasks a week at forty-five minutes of avoidable rebuild each, that is around 11 hours a week, or 48 hours a month, of engineering time recovered. Whether that outweighs a run cost in the region of $600 to $1,400 a month depends on our loaded hourly rate, which should be filled in before this is presented rather than assumed here.

I would not lean on that calculation as the main argument, because at many rates it lands close to break-even. The returns that are harder to put a number on are the ones that actually justify this:

  • The bottleneck comes off one person. Work that today only the original developer can safely perform becomes work a junior developer can perform inside provable limits. That is capacity, and it compounds.
  • Project knowledge stops being a personal asset. Right now, one person leaving takes a meaningful share of our institutional memory with them. This is the risk the platform most directly reduces, and it is not currently mitigated at all.
  • We gain an audit trail we do not have. Today we cannot say what changed on a given project, when, or who approved it. After Phase 2 we can, for every change.
  • Turnaround time on small work drops sharply, because the expensive part — rebuilding context — is what gets eliminated.

12Explicitly out of scope

Stated so that expectations do not drift during the build.

  • No model training or fine-tuning. This is retrieval and prompt assembly. Anyone expecting a model that learns our codebase in a machine-learning sense should be corrected early.
  • No autonomous deployment. A human approves every change that reaches production, in every phase.
  • Not a replacement for developers. It removes context reconstruction, not judgement. Review load moves to seniors and should be accounted for.
  • Not a general-purpose agent platform. It does one job: maintaining and extending the software we have already shipped.

13Open items to confirm before Phase 0

Four of these are assumptions the plan depends on. The fifth is a governance question I cannot answer alone.

ItemWhy it matters
Is every active project in version control?The entire review gate depends on it. Any project that exists only on its server must be brought into git during Phase 0, and that work needs to be counted.
Do projects have runnable tests?Without them the automated gate before human review is weak, and the reviewer carries more load. Projects without tests should be identified early and prioritised.
Do we have error tracking on production?Phase 5's error-to-job flywheel depends on it. Worth adding during Phase 1 if not.
Lark webhook access for the leadership groupNeeded for the alerting path in Phase 4.
Who approves a change when the person dispatching it is also the only reviewer?Self-approval defeats the gate that the rest of this design rests on. We need either a named second reviewer or an explicit, written self-approval policy with defined limits. This is a decision for you, not for me.

14The ask

Approve Phase 0 and Phase 1

Roughly 9 person-weeks, about 22 weeks elapsed at current capacity, at an infrastructure and usage cost of approximately $180 to $380 a month.

Those two phases introduce no job dispatch, no credential storage and no staff access — and therefore no new security surface — while delivering the project registry, the fleet view, and the knowledge layer that solves the problem in Section 1 on its own.


Also requested

  • A decision on the reviewer question in Section 13, before Phase 0 begins.
  • An in-principle view on resourcing, so I can plan Phase 2 honestly: a second developer roughly halves the remaining timeline.
  • Agreement that Phases 2 to 5 are separate approvals, each gated on the previous phase being in real use.