AI-Coding-Agent-Workspace-Spec-Pack
What this is. The master spec pack for an AI Coding Workspace. The project ships two product lines on one Laravel brain:
(A) AI Coding Agent platform β Laravel web Control Center + iPhone SwiftUI app, both clients of the same Laravel API.
(B) AI-Powered Documentation Workspace β the STV sub-pack (open), nested as a sub-page below.
Every sub-page mirrors 1:1 into docs/ and is consumed by Cursor and Claude Code. First-file entry point: HOW TO START AND USE.
Production stack (locked β B0 wins over any older mention). CentOS-compatible Linux + LiteSpeed + lsphp 8.3 (LSAPI) + Laravel 11 + MySQL 8 / MariaDB 11.4+ + Redis 7 + Horizon + Supervisor + Let's Encrypt.
Forbidden (do not propose, configure, or install): Nginx Β· Apache Β· PHP-FPM Β· PostgreSQL-as-default Β· pgvector-as-default Β· Qdrant Β· Milvus Β· Weaviate Β· Android in v1 Β· multi-tenant org/team in v1 Β· direct OpenAI / Anthropic / Claude Code calls from Swift or JS Β· Notion branding / logo / exact UI.
Architecture lock (canonical, verbatim β do not paraphrase). CentOS-compatible Server = production OS Β· LiteSpeed Web Server = production web server Β· Laravel Web App = full control center Β· Laravel API = shared backend for web and iPhone Β· MySQL/MariaDB = SQL source of truth Β· Swift iPhone App = mobile remote control through Laravel API only Β· RAG = project memory Β· Git = safe branch/snapshot workflow Β· Console = live debugging layer Β· Docs = always updated Β· Claude Code = development assistant with strict project rules.
This exact block must appear verbatim in CLAUDE.md, .claude/RULES.md, .claude/PROJECT_CONTEXT.md, and docs/00-product-overview.md. CI step claude-rules-lint enforces it.
Global AI Text Selection Editor (F1). A Notion-AI-style select β ask β preview β apply layer, active everywhere a user reads or edits text β project / task / comment / note / agent prompt / run summary / AI response / admin note. Any earlier wording that scoped this to one surface is superseded.
Source of Truth System. This pack is a controlled specification system, not a folder of notes. Every page is a versioned spec with a Spec ID, owner role, authority level, status, sync targets, dependencies, and change policy. The whole pack mirrors 1:1 into docs/. The rules below govern who can change what and what wins when two pages disagree. Treat the Source of Truth system as the constitution of the documentation system itself.
Canonical diagrams (Option 1). The projectβs Mermaid diagrams are centralized in π§ARCHITECTURE_DIAGRAMS (Canonical). Other pages should link to those diagrams instead of duplicating Mermaid blocks.
Documentation visual system. Formatting + export conventions are defined in ποΈDOCS_SYSTEM (Visual + Export Standard). When in doubt, follow that page for headings/callouts/placeholder patterns.
Source of Truth System
Spec Header
Every spec page (HUB, B0, B1, F1, C1, C2, 00β18) MUST open with a callout containing the block below. Filled values per page live in the Spec Registry. The same block becomes the YAML front-matter of the mirrored docs/<file>.md in the repo.
spec_id: SPEC-<short>
title: <human title>
version: <semver> # bump on every material edit
status: Planned | Approved | In Build | Implemented | Deprecated
authority: Constitutional | Architecture | Specification | Implementation | Reference
priority: P0 | P1 | P2 | P3
owner_role: <role title> # who writes the spec
reviewers: [<role>, <role>] # who must sign off on changes
last_reviewed: YYYY-MM-DD
sync_targets: # repo files this spec owns
- <path or glob>
depends_on: [<Spec ID>, ...] # upstream specs this assumes
consumed_by: [<Spec ID>, ...] # downstream specs / code
conflict_rule: <pointer to higher authority or sibling tiebreaker>
change_policy: <who can change, what gates apply>Authority Hierarchy
Five levels, highest first. Higher beats lower in every conflict.
- Constitutional β the architecture-lock verbatim block in this hub. One source. Never paraphrased. Verbatim in
CLAUDE.md,.claude/RULES.md,.claude/PROJECT_CONTEXT.md,docs/00-product-overview.md. Enforced byclaude-rules-lint.
- Architecture β cross-cutting decisions that constrain the whole codebase: B0 (server), B1 (Laravel core), F1 (Selection Editor), 01 (platform strategy), 02 (backend modules & data model). Change requires architect sign-off plus a Registry version bump.
- Specification β feature-level specs: pages 00, 03β18, C1, C2. Owns concrete features, contracts, schemas, endpoints. Change requires spec owner plus one reviewer of a different role.
- Implementation β runnable how-to: build prompts,
HOW TO START, deployment runbooks, the diagnose command. Generated from Specifications; not authoritative on its own.
- Reference β glossary, changelog, audit trail, indexes. Read-only relative to higher levels.
Conflict Resolution
- Constitutional > Architecture > Specification > Implementation > Reference. Always.
- Within the same level, the spec listed in the Spec Registry as canonical for a given concern wins. The loser must be revised, cross-referenced, or marked
Deprecated.
- Verbatim blocks (architecture lock, forbidden list) are sacred. If another page contradicts them, the other page is wrong by definition.
- Two specs cannot both claim the same
sync_target. The Registry assigns exactly one primary owner; others list the path underconsumed_by.
- Any change to a Constitutional or Architecture spec requires: (a) version bump in the Registry, (b) entry in
docs/CHANGELOG_AI.md, (c) sign-off from a reviewer role distinct from the author.
- When a spec flips to
Deprecated, every page listing it underdepends_onMUST be re-reviewed in the same edit pass.
- If a Claude Code or Cursor session encounters a runtime conflict, it stops and surfaces the disagreement. It never silently picks one.
Sync Targets
- Paths are relative to repo root (
docs/...,.claude/...,.cursor/rules/...,app/Services/...,resources/js/ai-text-editor/...).
- A spec owns the file or directory and every doc generated from it.
- Specs MAY share a directory only when file patterns are disjoint (e.g.
OpenAIAgentService.phpbelongs to SPEC-07;ClaudeCodeAgentService.phpbelongs to SPEC-06).
- Generated regions inside a human-owned file are wrapped in
<!-- AUTO-GENERATED:START spec=SPEC-XX --> ... <!-- AUTO-GENERATED:END -->. Anything outside the markers belongs to humans.
- Mirroring direction is Notion β repo. A Cursor/Claude Code edit may propose a change to a Notion spec via
docs/CHANGELOG_AI.md, but must not edit the Notion page directly.
Spec Registry
| Spec ID | Title | Version | Status | Authority | Priority | Owner role | Primary sync targets | Notion page |
|---|---|---|---|---|---|---|---|---|
| SPEC-HUB | Master Spec Pack β hosts both product lines + production-ready Claude Code prompt (Β§10) (this page) | 1.4.0 | Approved | Constitutional | P0 | Product architect | docs/00-product-overview.md, the arch-lock block in CLAUDE.md and .claude/RULES.md, docs/SPEC_REGISTRY.md | this page |
| SPEC-B0 | Production Infrastructure (CentOS + LiteSpeed + MySQL) | 1.0.0 | Approved | Architecture | P0 | DevOps architect | docs/CENTOS_LITESPEED_DEPLOYMENT.md, docs/LITESPEED_SECURITY.md, docs/LITESPEED_CACHE_RULES.md, docs/QUEUE_AND_CRON.md, docs/SERVER_HEALTH.md | B0 |
| SPEC-B1 | Laravel Web App Core + SQL Database | 1.0.0 | Approved | Architecture | P0 | Backend architect | app/, config/agent_workspace.php, database/migrations/, routes/, docs/PROJECT_MAP.md, docs/DATABASE_SCHEMA.md | B1 |
| SPEC-F1 | Global AI Text Selection Editor | 1.0.0 | Approved | Architecture | P0 | Product architect | resources/js/ai-text-editor/, app/Services/AiTextTransformService.php, docs/AI_SELECTION_EDITOR.md | F1 |
| SPEC-C1 | Claude Code Setup Guide & HOW TO START | 1.1.0 | Approved | Specification | P0 | Developer-tooling lead | CLAUDE.md (root), HOW TO START.md, docs/HOW_TO_START_WITH_CLAUDE_CODE.md | C1 |
| SPEC-C2 | Claude Code Project Bundle (.claude/ files) | 1.0.0 | Approved | Specification | P0 | Developer-tooling lead | .claude/**, .cursor/rules/** | C2 |
| SPEC-00 | Product Overview & Goals | 1.0.0 | Approved | Specification | P0 | Product architect | docs/00-product-overview.md | 00 |
| SPEC-01 | Platform Strategy & Stack | 1.0.0 | Approved | Architecture | P0 | Product architect | docs/01-platform-strategy.md | 01 |
| SPEC-02 | Backend Modules & Data Model | 1.0.0 | Approved | Architecture | P0 | Backend architect | docs/02-backend-modules.md, app/Services/** | 02 |
| SPEC-03 | Database Migrations | 1.0.0 | Approved | Specification | P0 | Database architect | database/migrations/**, docs/03-database-migrations.md, docs/DATABASE_SCHEMA.md, docs/DATABASE_RELATIONS.md | 03 |
| SPEC-04 | RAG System Design | 1.0.0 | Approved | Specification | P0 | RAG engineer | app/Services/Rag/**, docs/RAG_SYSTEM.md | 04 |
| SPEC-05 | Agent Providers & Specialized Agents | 1.0.0 | Approved | Specification | P0 | AI workflow lead | app/Services/Agents/**, docs/AI_AGENTS.md, docs/AGENT_WORKFLOW.md | 05 |
| SPEC-06 | Claude Code Integration (in-app) | 1.0.0 | Approved | Specification | P0 | AI workflow lead | app/Services/Agents/ClaudeCodeAgentService.php, docs/CLAUDE_CODE_INTEGRATION.md | 06 |
| SPEC-07 | OpenAI API Integration | 1.0.0 | Approved | Specification | P1 | AI workflow lead | app/Services/Agents/OpenAIAgentService.php, docs/OPENAI_INTEGRATION.md | 07 |
| SPEC-08 | Server Params & Configuration | 1.0.0 | Approved | Specification | P1 | Backend architect | app/Models/ServerParam.php, config/agent_workspace.php, docs/SERVER_PARAMS.md | 08 |
| SPEC-09 | Git Workflow & Safety | 1.0.0 | Approved | Specification | P0 | DevOps architect | app/Services/Git/**, docs/GIT_WORKFLOW.md | 09 |
| SPEC-10 | Auto Documentation System | 1.0.0 | Approved | Specification | P1 | Docs lead | app/Services/Docs/**, docs/10-auto-documentation.md | 10 |
| SPEC-11 | Cursor Rules Pack | 1.0.0 | Approved | Specification | P1 | Developer-tooling lead | .cursor/rules/** | 11 |
| SPEC-12 | Console Log UI | 1.0.0 | Approved | Specification | P1 | Frontend lead | resources/js/console/**, docs/12-console-ui.md | 12 |
| SPEC-13 | iPhone SwiftUI App | 1.0.0 | Approved | Specification | P0 | iOS lead | ios/**, docs/IPHONE_APP_PLAN.md | 13 |
| SPEC-14 | API Endpoints Reference | 1.0.0 | Approved | Specification | P0 | Backend architect | routes/api.php, app/Http/Controllers/Api/**, docs/API_ENDPOINTS.md | 14 |
| SPEC-15 | Security Rules & Threat Model | 1.0.0 | Approved | Specification | P0 | Security lead | app/Policies/**, docs/SECURITY.md | 15 |
| SPEC-16 | PROJECT_MAP / DATABASE_SCHEMA / DIAGRAMS templates | 1.0.0 | Approved | Implementation | P2 | Docs lead | docs/16-templates/** | 16 |
| SPEC-17 | Implementation Roadmap | 1.0.0 | Approved | Reference | P2 | Product architect | docs/17-roadmap.md, docs/CHANGELOG_AI.md | 17 |
| SPEC-18 | Laravel Web Admin Panel & Control Center | 1.0.0 | Approved | Specification | P0 | Frontend lead | app/Filament/**, resources/views/**, docs/WEB_APP_PLAN.md | 18 |
| SPEC-STV-HUB | STV sub-pack root β AI-Powered Documentation Workspace (integrated product line, v1.3.0 project-final polish). 14 sub-specs listed in the STV sub-registry at Β§10 of the sub-pack. | 1.3.0 | Approved | Constitutional (STV scope) | P0 | Product architect | STV sub-tree: docs/PRODUCT_OVERVIEW.md, docs/ARCHITECTURE.md, docs/DATABASE_SCHEMA.md, docs/API_ENDPOINTS.md, docs/EDITOR_SYSTEM.md, docs/BLOCK_TYPES.md, docs/TEMPLATE_SYSTEM.md, docs/RAG_SYSTEM.md, docs/AI_ASSISTANT.md, docs/MOBILE_UX.md, docs/SECURITY.md, docs/SCALABILITY.md, docs/CHANGELOG_AI.md, docs/MOBILE_GESTURES_AND_TEXT_SELECTION_EDITOR.md β’ app/Services/{Pages,Blocks,Databases,Templates,Ai,Rag,Search,Activity}/**, resources/js/editor/**, resources/js/ai-selection/**, app/Policies/** (STV scope), app/Filament/** (admin), .cursor/rules/{project-overview,database,editor,security,rag,mobile}.mdc | πAI-Powered-Documentation-Workspace |
Roles
- Product architect β owns vision, lock, registry.
- Backend architect β owns Laravel core, models, routes, DB schema.
- Database architect β owns migrations, relations, indexes.
- RAG engineer β owns indexing, embedding, retrieval, secret exclusion.
- AI workflow lead β owns agents, skills, prompts, run lifecycle.
- Frontend lead β owns Filament panels, Livewire, Console UI, F1 mount.
- iOS lead β owns Swift client, parity contract.
- DevOps architect β owns server, queues, schedule, snapshots, Git ops.
- Security lead β owns threat model, auth, abilities, audit, secret scanning.
- Developer-tooling lead β owns
.claude/,.cursor/, the Claude Code CLI guide.
- Docs lead β owns doc generators, templates,
CHANGELOG_AI.
A reviewer must hold a different role from the author. Two-eyes minimum for Architecture+; one-eye minimum for Specification.
Change Management
- Draft β edit the Notion page; set
status: PlannedorIn Buildin the spec header.
- Bump version β semver. Major = breaking spec change (sync target removed, contract renamed); minor = additive; patch = wording or clarification.
- Update Registry β bump the row in the Spec Registry in the same edit pass.
- Log it β append a line to
docs/CHANGELOG_AI.mdwith<date> | SPEC-XX | <author role> | <version> | <one-line summary>.
- Re-review dependants β every spec listed under
consumed_bymust be re-checked. If any breaks, either revise the dependant in the same pass or roll back.
- Mirror to repo β only after Notion review. A repo PR may not edit Notion-owned content directly; it edits the mirrored
docs/<file>.mdand the matching<!-- AUTO-GENERATED:* -->blocks.
CI Enforcement
claude-rules-lintβ verifies the architecture-lock verbatim block inCLAUDE.md,.claude/RULES.md,.claude/PROJECT_CONTEXT.md,docs/00-product-overview.md. Fails CI on drift.
spec-registry-lintβ parses the Registry (mirrored todocs/SPEC_REGISTRY.md) and asserts: everysync_targetexists OR is markedPlanned; no two specs claim the same primarysync_target; every Spec ID referenced underdepends_onexists.
secrets-scanβ runs on every PR; refuses commits matchingsk-*,ghp_*, AWS access keys, JWTs.
php artisan agent-workspace:diagnoseβ runtime guard; surfaces any drift between the deployed app and the active specs.
Status Legend
- Planned β spec exists, code does not.
- Approved β spec finalized, build authorized, code may be missing or partial.
- In Build β code is actively landing PRs against this spec.
- Implemented β code matches spec; CI green; doc mirrors current.
- Deprecated β spec superseded; do not consume. The replacement must be cited under
consumed_by.
Rollout Plan
- Phase 1 (done). The SoT section is live on the master hub. SPEC-HUB v1.0.0 β v1.1.0 (SoT system adopted) β v1.2.0 (sister pack adopted as idea & improvement track) β v1.3.0 (STV sub-pack physically merged as sub-page of this hub; Β§9 renamed to Integrated Second Product Line; STV-HUB row added to Β§SoT.5; "sister/peer" framing retired) β v1.4.0 (final repolish: Β§9 prose normalized to "product line" vocabulary throughout; Β§10 Production-Ready Build Prompt for Claude Code added with verbatim prompt, allowlist sketch, acceptance gates, and day-one operating loop; "one final documentation" milestone).
- Phase 2 (next pass). Add the spec-header callout (Spec Header) to the top of every page: HUB, B0, B1, F1, C1, C2, 00β18.
- Phase 3. Mirror the Registry into
docs/SPEC_REGISTRY.mdand wirespec-registry-lintinto CI.
- Phase 4. Every future page or section change opens with a Registry version bump and a CHANGELOG_AI line; no exceptions. Cross-pack changes that touch Β§9.3 shared doctrine require the matching edit on the sister pack in the same pass.
Versioning
Every spec page in the Registry follows strict semantic versioning. The discipline guarantees that any consumer (Claude Code session, Cursor rule, CI lint, downstream spec) can compute compatibility at a glance and decide whether a re-review is required.
- Major (X.0.0) β breaking spec change. A
sync_targetwas removed or renamed; a contract field disappeared; an authority tier was downgraded; adepends_onedge was severed. Every spec listed underconsumed_byMUST be re-reviewed in the same edit pass before the bump merges.
- Minor (1.X.0) β additive change. New sections, new sync_targets, new optional fields, clarifications that close ambiguity. Backward compatible by definition. Consumers are notified but not blocked.
- Patch (1.0.X) β wording, typo, formatting, callout color, link repair, version-drift alignment. No semantic change. No re-review required, but CHANGELOG_AI entry still mandatory.
- Rollback β version numbers are monotonic; a rollback is a new version with a
Reverts: vX.Y.Znote in CHANGELOG_AI, never an in-place rewrite of the previous tag.
- Pre-release tags β
vX.Y.Z-rc.Nis allowed for Architecture+ tier specs during a long migration; production code never consumes a pre-release tag.
Drift Detection
Drift is any divergence between the Notion spec, the mirrored docs/<file>.md, and the deployed code. Three guards keep drift bounded:
- Mirror lint (
docs-mirror-lint) β compares the SHA-256 of eachdocs/<file>.mdagainst the SHA-256 recorded in the Notion spec header (mirrored on every save). Mismatch β CI fails with a one-liner pointing at the offending Spec ID and the diff cursor.
- Sync-target audit (
sync-target-audit) β walks everysync_targetglob in the Registry and asserts the path exists (forApproved+ specs) or is markedPlanned(for the rest). Orphan files inside an owned glob trigger a warning to the spec owner via the daily digest.
- Runtime diagnose (
php artisan agent-workspace:diagnose) β surfaces drift between the deployed app and the active specs (missing migrations, missing env keys, missing service classes, missing slash commands, MCP server unreachable). Run on every deploy and on every Claude Code session start.
Remediation playbook: (a) determine which side is authoritative per the Authority Hierarchy; (b) open a same-pass PR that either bumps the spec or updates the code; (c) record the drift cause in CHANGELOG_AI under category drift-fix; (d) if the drift was caused by an out-of-band manual edit, write a one-paragraph note in docs/INCIDENTS.md so the team learns the exact failure mode.
Deprecation
No spec is deleted. Deprecation is a four-stage transition; skipping a stage is forbidden.
- Marked β
status: Deprecated,consumed_byrewritten to point at the replacement Spec ID. Page banner added at the top: "This spec is deprecated. See {replacement}." All downstream consumers are notified in the next daily digest.
- Quarantined β
sync_targetscleared. Any file previously owned by this spec is reassigned to the replacement in the same pass.spec-registry-lintenforces zero overlap. The page remains readable but is no longer indexed by RAG.
- Sunset β the page is moved under the master hub's
/_archivesub-page. It remains addressable by URL forever; new Claude Code sessions are instructed never to consume it. Cursor rules referencing the old Spec ID are auto-rewritten to point at the replacement.
- Tombstoned β after one major release cycle (or 6 months, whichever is longer), the page is reduced to a single redirect callout and a CHANGELOG_AI entry. Body is preserved in Git history of the repo mirror so audits can replay any past state.
A deprecated spec may be un-deprecated only by a same-pass PR that documents why the replacement failed and re-establishes the previous spec as canonical; this is rare and requires two-eyes review at the Architecture tier or higher.
0 Β· TL;DR
A structured AI coding workspace where a user gives a real software task to an AI agent, and the system manages:
- project workspace (cloned repo on the server)
- code inspection (routes, controllers, models, migrations, services, jobs, events, policies, config)
- RAG context (pgvector-backed, project-scoped)
- file changes (tracked, hashed, diffed)
- terminal commands (allowlist + blocklist, sandboxed)
- Git (branch-per-run, snapshots, optional commit/push)
- snapshots and revisions (pre-run, pre-command, final)
- live console log (every event, every payload, streamed via SSE)
- automatic documentation update (PROJECT_MAP, DATABASE_SCHEMA, ARCHITECTURE_DIAGRAMS, etc.)
- multiple specialized agents (Architect, Backend, Frontend, iPhone, RAG, QA, DevOps, Documentation)
- providers: OpenAI, Claude API, Claude Code, local shell runner
- iPhone-first SwiftUI client driven by a clean REST/SSE API
It is not a chatbot. It is an execution platform with full auditability and safe recovery.
1 Β· Product Pillars
Real code, real results
The agent operates on a real cloned repo, not on pasted snippets.
Context before action
RAG must be queried before any plan or edit. Never guess when context exists.
Safe by default
Snapshots, allowlists, branch-per-run, manual approval before push.
Everything is logged
Every event, command, file change, RAG hit and Git op is persisted.
Pause / resume
Agents can stop for user input and resume exactly where they left off.
Two clients, one brain
Laravel Control Center and iPhone SwiftUI app both drive the same API with full feature parity.
2 Β· Specification Pack Index
Numbered for direct 1:1 mirroring into the docs/ folder of the codebase.
Each child page is self-contained and can be exported as a Markdown file.
Sub-pages will be created below. They form the canonical documentation set:
- 00 β Product Overview & Goals
- 01 β Platform Strategy & Stack
- 02 β Backend Modules & Data Model
- 03 β Database Migrations
- 04 β RAG System Design
- 05 β Agent Providers & Specialized Agents
- 06 β Claude Code Integration
- 07 β OpenAI API Integration
- 08 β Server Params & Configuration
- 09 β Git Workflow & Safety
- 10 β Auto Documentation System
- 11 β Cursor Rules Pack
- 12 β Console Log UI Spec
- 13 β iPhone SwiftUI App Spec
- 14 β API Endpoints Reference
- 15 β Security Rules & Threat Model
- 16 β PROJECT_MAP / DATABASE_SCHEMA / DIAGRAMS templates
- 17 β Implementation Roadmap
- 18 β Laravel Web Admin Panel & Control Center Spec
Build prompts (executable):
- B0 β Production Infrastructure (CentOS + LiteSpeed + Laravel + MySQL) β server-build authoritative source.
- B1 β Laravel Web App Core + SQL Database β app-skeleton authoritative source.
Global features (cross-cutting specs):
- F1 β Global AI Text Selection Editor (Notion-AI-style layer) β app-wide select-to-AI overlay across every text surface; wired into B1, B5, B6, pages 14, 15, 18.
Claude Code (developer & in-app rules):
- C1 β Claude Code Setup Guide & HOW TO START.md β the developer-side onboarding (install, first prompt, slash commands, MCP servers, safety rails, the verbatim
HOW TO START.mdfile).
- C2 β Claude Code Project Bundle (
.claude/files) β authoritative bodies forCLAUDE.md,.claude/PROJECT_CONTEXT.md,.claude/RULES.md,.claude/TOOLS.md,.claude/WORKFLOW.md,.claude/settings.json, sub-agents, slash commands, hooks. The same bundle is loaded by the in-appClaudeCodeAgentService(page 06) β one bundle, two surfaces.
3 Β· System at a Glance
flowchart LR
Web(["Web operator<br>Filament + Livewire"]) -->|HTTPS + Reverb WS| API["Laravel API + Control Center"]
IOS(["iPhone operator<br>SwiftUI"]) -->|HTTPS + SSE| API
API --> Orchestrator["AgentRunOrchestrator"]
Orchestrator --> Providers{"Provider"}
Providers -->|OpenAI API| OAI["OpenAI"]
Providers -->|Claude API| CLA["Anthropic"]
Providers -->|Claude Code adapter| CC["Claude Code CLI"]
Orchestrator --> RAG["RagContextService<br>pgvector"]
Orchestrator --> WS["WorkspaceService<br>(isolated repo)"]
Orchestrator --> GIT["GitService"]
Orchestrator --> SNAP["SnapshotService"]
Orchestrator --> DOCS["DocumentationAutoUpdateService"]
Orchestrator --> EVT["ConsoleEventService<br>(agent_events)"]
EVT -->|SSE / WebSocket| API
WS --> FS[("Project workspace<br>on disk")]
RAG --> PG[("PostgreSQL + pgvector")]
EVT --> PG
SNAP --> S3[("Snapshot store")]4 Β· Agent Run Lifecycle
stateDiagram-v2
[*] --> draft
draft --> queued: start()
queued --> running: worker picked up
running --> waiting_for_user: agent needs input
waiting_for_user --> running: user responds
running --> paused: user pause()
paused --> running: resume()
running --> completed: final_summary
running --> failed: fatal error
running --> cancelled: user cancel()
completed --> [*]
failed --> [*]
cancelled --> [*]5 Β· Core Design Decisions
Why Laravel 11 + Horizon + Redis + PostgreSQL + pgvector
- Laravel 11 gives a mature HTTP/queue/auth stack and Sanctum for token auth out of the box.
- Horizon makes long-running agent jobs observable and supervisable.
- Redis is the event bus for SSE/WebSocket fan-out, queue backend, and short-lived locks (one agent per project workspace at a time).
- PostgreSQL is the durable store. pgvector is preferred for
rag_chunks.embedding. If the existing app is on MySQL, the abstraction layer (RagContextService) keeps the storage backend swappable.
Why branch-per-run + snapshots
- Every run gets its own Git branch
agent/run-{run_id}-{slug}. The default branch is never modified by an agent.
- A
pre_runsnapshot (tar + commit hash) is created before any change. Apre_commandsnapshot is created before any destructive command.
- Restoring a snapshot is always possible without losing audit history.
- Every run gets its own Git branch
Why provider-agnostic agents
AgentProviderInterfaceabstracts OpenAI, Claude API, Claude Code, and local shell runner.
- Same RAG, same workspace, same event log β only the model/tool layer changes.
- Adding a new provider is a single class implementing the interface.
Why web-first, mobile-supported
- The Laravel Control Center is the primary operator surface: admin, RAG inspector, diff review, plan/approve, server params, audit log.
- The iPhone app is a fully-featured remote with full feature parity β same API, same events, same actions. Parity is enforced by a CI contract test.
- The API is designed to serve both transports cleanly: WS over Reverb for the web client, SSE for the iPhone client, both fanned out from one
ConsoleEventService::publish().
- Earlier wording called this "iPhone-first". That is superseded.
Why LiteSpeed + lsphp on CentOS-compatible Linux
- LSWS LSAPI is markedly faster than PHP-FPM for PHP workloads and ships native HTTP/2 + HTTP/3 (QUIC). The iPhone client benefits directly from QUIC on mobile networks.
- CentOS-compatible (AlmaLinux 9 / Rocky 9) gives long-support RPM packaging, SELinux enforcing, and is widely supported by managed-hosting providers.
- The full infra and tuning lives in B0; this page only references it.
6 Β· Top-Level Folder Layout (target)
app/
Http/Controllers/Api/
Models/
Services/
Agents/
OpenAIAgentService.php
ClaudeAgentService.php
ClaudeCodeAgentService.php
AgentRunOrchestrator.php
Rag/
RagContextService.php
ProjectIndexer.php
Workspace/
WorkspaceService.php
CommandExecutionService.php
SnapshotService.php
Git/
GitService.php
Docs/
DocumentationAutoUpdateService.php
ProjectMapService.php
SchemaAnalyzerService.php
Events/
ConsoleEventService.php
Jobs/
Events/
Listeners/
config/agent_workspace.php
database/migrations/
docs/
PROJECT_CONTEXT.md
PROJECT_MAP.md
DATABASE_SCHEMA.md
ARCHITECTURE_DIAGRAMS.md
API_ENDPOINTS.md
RAG_SYSTEM.md
AGENT_WORKFLOW.md
CLAUDE_CODE_INTEGRATION.md
OPENAI_INTEGRATION.md
SERVER_PARAMS.md
GIT_WORKFLOW.md
IPHONE_APP_PLAN.md
SECURITY.md
CHANGELOG_AI.md
.cursor/rules/
project-overview.mdc
architecture.mdc
database.mdc
rag-system.mdc
agent-workflow.mdc
git-workflow.mdc
testing.mdc
security.mdc
iphone-first.mdc
documentation-auto-update.mdc
.claude/
PROJECT_CONTEXT.md
RULES.md
TOOLS.md
WORKFLOW.md
ios/
AgentWorkspace.xcodeproj/
AgentWorkspace/...7 Β· Non-Goals (explicit)
Each non-goal below is intentional. Adding any of these reopens the architecture lock and requires a SPEC-HUB minor bump with a written rationale that survives reviewer-set sign-off.
- No Android client in v1. SwiftUI iPhone is the only mobile-native surface in v1. Rationale: parity is hard to enforce across two native platforms during iPhone bring-up; mobile-web covers Android users until a dedicated Android spec is written.
- No multi-tenant org/team model in v1 β single-owner workspaces with API tokens. Rationale: tenancy invariants leak into every policy, query, and cache key; defer until the single-tenant path is hardened.
- No web IDE β file edits are applied by the agent, reviewed in diff form. Rationale: an in-app IDE would compete with Cursor / Claude Code without adding leverage; diff review is sufficient at this stage.
- No automatic push to remote. Push is always a deliberate user action. Rationale: an in-repo agent that can push can also publish bad commits; the human gate is mandatory.
- No execution of arbitrary unsigned shell commands. Allowlist only (see
.claude/settings.json). Rationale: a misbehaving model plus an open shell equals a production outage; the allowlist is the seatbelt.
- No PostgreSQL or pgvector as default. Opt-in only behind the RAG abstraction. Rationale: MySQL 8 / MariaDB 11.4+ is the production lock; pgvector lives as an opt-in upgrade path for very large RAG indexes.
- No Notion branding, logo, exact UI, proprietary design, colors, design tokens, or icon set anywhere in the shipping product. Rationale: the product is an original high-end design; the inspiration is Notion-class quality, not Notion-clone surface.
- No agent self-modification of Notion content from the repo. Repo edits propose changes to Notion via
docs/CHANGELOG_AI.md; humans apply them. Rationale: Notion is the human-curated source of truth; one-way mirroring is the only safe direction.
8 Β· Glossary
| Term | Meaning |
|---|---|
| Project | A real software codebase cloned into an isolated server workspace. |
| Run | One coding task given to one agent on one project. Has a lifecycle and a branch. |
| Event | A row in agent_events. The atomic unit of the console log. |
| Snapshot | A point-in-time recovery artifact (Git commit + optional tar archive). |
| Provider | An implementation of AgentProviderInterface (OpenAI, Claude API, Claude Code, local). |
| Specialized agent | A higher-level role (Architect, Backend, β¦) that selects prompts, tools and a provider. |
| RAG chunk | One indexed, embedded fragment of project context in rag_chunks. |
| Project Map | The canonical route β controller β model β table β service relationship doc. |
| STV sub-pack | The integrated AI-Powered Professional Documentation Workspace sub-pack (StevoApp Β· SPEC-STV-HUB v1.3.0, project-final polish), the second product line of this project, physically nested under this hub. See πAI-Powered-Documentation-Workspace and Β§9. |
9 Β· Integrated Second Product Line Β· AI-Powered Documentation Workspace (STV)
Merged into project v1.3.0. This project now hosts two product lines under one master hub: (1) AI Coding Agent platform (the original scope of this pack, SPECs HUB / B0 / B1 / F1 / C1 / C2 / 00β18), and (2) AI-Powered Professional Documentation Workspace β the STV sub-pack at πAI-Powered-Documentation-Workspace (SPEC-STV-HUB v1.3.0, project-final polish), now physically nested as a sub-page of this hub. They share one Β§SoT system, one Spec Registry (this hub's Spec Registry points to the STV sub-registry at section 10 of the sub-pack), one CHANGELOG_AI, one reviewer pool. The two product lines remain conceptually distinct (different end users, different domain objects, different sync target trees) so contributors keep mental clarity; governance is unified.
Product Line Identity
| Dimension | Product line A β AI Coding Agent platform | Product line B β AI-Powered Documentation Workspace (STV sub-pack) |
|---|---|---|
| Spec root | SPEC-HUB v1.4.0 β this page (master hub of the whole project) | SPEC-STV-HUB v1.3.0 β πAI-Powered-Documentation-Workspace, nested under this master hub |
| End user | Operator / engineer running coding agents on real repos. | Knowledge worker creating, organizing, improving, rewriting, summarizing, publishing and maintaining professional documentation with AI. |
| Primary surface | Laravel Control Center + iPhone SwiftUI client, both clients of the same Laravel API. | Block-based web editor (Livewire 3 + Alpine + Tailwind), mobile-responsive from day one; future SwiftUI client. |
| Domain object | Project Β· Run Β· Event Β· Snapshot Β· Agent Β· RAG chunk. | Workspace Β· Page Β· Block Β· Database Β· View Β· Template Β· Comment Β· Share Β· RAG chunk. |
| SQL layer | MySQL 8 / MariaDB 11.4+ (B0 lock). | MySQL 8 / MariaDB 11.4+ (same lock). |
| Realtime | SSE for console; WS via Reverb for Filament. | WS for autosave / presence; SSE for AI token streaming. |
| RAG store | rag_chunks (MySQL JSON default; pgvector opt-in). | rag_chunks (MySQL JSON default; pgvector opt-in). |
| Admin layer | Filament (operator-facing). | Filament (admin-only; end users never see Filament). |
| Authority | Constitutional (this pack). | Constitutional (its own pack). |
Scope Boundary
- No mixing of domain objects. A
Runbelongs to product line A (Coding Agent); aPagebelongs to product line B (STV). Neither product line imports the other's tables, routes, controllers, services, or Livewire components.
- Co-hosted in one Laravel repo, isolated by namespace. Both product lines may ship in the same Laravel repo. Each lives under its own service namespace (
app/Services/Agents/**vsapp/Services/Pages/**); migrations are non-overlapping; route prefixes are distinct (/api/v1/runs/*vs/api/v1/pages/*); Filament panels live under distinct route prefixes.
- No cross-citation in RAG by default. Product line A's RAG indexes project code and coding-run history; product line B's RAG indexes user-authored documentation. A workspace in one is never a workspace in the other unless an explicit, audited bridge service is built (see Β§9.5 candidate #2; opt-in, off by default).
- One user account model is allowed but not required. When both product lines ship together, identity SHOULD use one
userstable with role grants per product line. SSO via OAuth/OIDC is the supported alternative; no foreign-key join from one product line's tables into the other.
- One admin surface, two Filament panels (or one with two clusters). A single operator can administer both product lines; permissions are split by Filament policy.
Shared Doctrine
- The Source of Truth system (authority hierarchy, conflict ladder, sync-target ownership, change-management protocol, CI guards).
- The architecture posture lock: MySQL/MariaDB as SQL source of truth; Redis 7; Horizon; Laravel 11/12; no PHP-FPM-as-default, no PostgreSQL-as-default, no Nginx-as-default.
- The forbidden lists (each product line maintains its own; the union is enforced project-wide β no Notion branding / logo / exact UI / proprietary design / colors / copyrighted elements anywhere in the product).
- The preview-gate principle for AI: AI never auto-applies to user content; user must explicitly accept / replace / insert / discard.
- The
CHANGELOG_AI.mddiscipline: append-only, one line per AI-assisted change, dated, attributed by role, formatted<YYYY-MM-DD> | SPEC-<id> | <author role> | <semver> | <one-line summary>.
- The secrets hygiene rules: no provider API keys in frontend, no
sk-*/ghp_*/ AWS keys / JWTs in any committed file, secret-scan in CI.
Promotion Path
| Step | Action | Gate |
|---|---|---|
| 1. Propose | Open a section in the source product line's roadmap (docs/17-roadmap.md for product line A; equivalent in STV) describing the candidate idea, why it belongs in the other product line, and what API / contract it would expose. | Product architect signs off as the source of the proposal. |
| 2. Mirror | Create a new spec in the target product line's Registry (NOT in the source). Assign owner role from the target product line's roster. | Registry version bump in the target product line. |
| 3. Cite | Add a consumed_by: line in the source spec pointing at the new target spec; add a depends_on: line in the target spec pointing at the source idea. | Two-eyes review across product lines. |
| 4. Implement | Code lands in the target product line's sync targets only. No source product line files are edited as part of the promotion. | CI green on the target product line; CHANGELOG_AI.md line on both sides referencing each other. |
| 5. Close | Source product line's roadmap entry flips to Promoted β SPEC-XXX-YY. Source spec is not deleted; it stays as a reference cross-link. | Product architect sign-off on both product lines. |
Cross-Pollination Ideas
- Run report β documentation page. When a coding-agent run completes (product line A), optionally export its final report into product line B as a
pageunder a designated workspace, with the run summary, diff, and snapshot links rendered as blocks. Owner candidate: AI workflow lead (source) + Frontend lead (target).
- Documentation page β agent context. Allow product line A's
RagContextServiceto read-only consume product line B's published documentation pages of a designated workspace as additional context, via a signed read-only token and a dedicatedconsumed_workspaceswhitelist. Strictly opt-in per coding-project.
- Selection editor parity. Both product lines ship a select-to-AI overlay (F1 in product line A; SPEC-STV-08 / SPEC-STV-13 in product line B). The prompt action vocabulary (improve / rewrite / shorter / longer / simplify / professional / translate / summarize / outline) is kept verbatim-identical across product lines so a single
.cursor/rules/*.mdcAI-action lint passes in both.
- CHANGELOG_AI line format. Standardized
<YYYY-MM-DD> | SPEC-<id> | <author role> | <semver> | <summary>across both product lines so a single tool can lint both logs (now part of shared doctrine in Β§9.3).
- Shared
claude-rules-lintcore. Extract the verbatim-block linter into a shared internal package consumed by both product lines (each product line supplies its own canonical block).
- Public read-only documentation host. Product line B's public-page reader (tokenized link + premium mobile reader) could expose read-only run reports from product line A as a publish target. Strictly opt-in; same threat-model gates as the STV
/public/{token}endpoint.
Conflict Rule
When something is genuinely shared (doctrine in Β§9.3) and the two product lines ever disagree, the version on this master hub (SPEC-HUB) is the doctrinal anchor for both, because the master hub defined the Source of Truth system first. Any STV sub-pack page that contradicts Β§9.3 must either bump its version with an explicit rationale (and update the doctrine on the master hub in the same edit pass) or revise to match. There is no silent divergence within the project.
Linked Artifacts
- STV sub-pack root: AI-Powered Professional Documentation Workspace Β· Spec Pack β SPEC-STV-HUB v1.3.0, Approved, nested as sub-page of this hub (project-final polish).
- STV sub-pack sub-specs (current count: 14): SPEC-STV-00 Product Overview, -01 Architecture & Modules, -02 Database Schema, -03 API Endpoints, -04 Editor System & 28 Block Types, -05 Databases / Tables, -06 Template System, -07 RAG Knowledge Base, -08 AI Writing Assistant, -09 Search, -10 Mobile & Desktop UX, -11 Sharing / Permissions / Security / Scalability / Admin, -12 Comments / Activity / Import-Export / Testing / Docs / CHANGELOG, -13 Mobile Gestures & Text Selection Editor.
- Mirror path in repo (if co-hosted):
docs/RELATED_PACKS.mdβ generated from this section, owner Docs lead.
10 Β· Production-Ready Build Prompt for Claude Code
This is THE prompt. Paste the block in Β§10.3 into Claude Code (or Cursor with the Claude provider) as the first message of a fresh session at the repo root. It transplants the Source of Truth system into the agent's working memory, locks every architectural ban, names every Spec ID with its sync targets, and gives a deterministic 14-phase build plan that ends in a production-deployable system. Iterations always resume from the last green CI commit β never from a "best guess".
Why This Exists
The Notion pack is the spec. The repo is the implementation. The bridge between them is this prompt. It does four jobs at once: (1) it transplants the Source of Truth system into Claude's working memory, (2) it forbids the things this project bans (Nginx, PHP-FPM, PostgreSQL-as-default, etc.), (3) it routes the agent to the correct sync targets per Spec ID, and (4) it gives a phased, gated execution plan so Claude does not invent features that are not in the Registry.
How to Use
- Clone the repo. Open Claude Code at the repo root (
claudeCLI, or via Cursor / IDE plugin).
- Confirm the C2 bundle exists:
CLAUDE.md,.claude/RULES.md,.claude/PROJECT_CONTEXT.md,.claude/TOOLS.md,.claude/WORKFLOW.md,.claude/settings.json,docs/SPEC_REGISTRY.md,docs/00-product-overview.md. If missing, the first session creates them from the Notion specs.
- Paste the prompt in Β§10.3 as the first message.
- Approve plans before edits. Approve commands before they run (allowlist in
.claude/settings.json).
- Every PR opened by Claude Code MUST: (a) cite one Spec ID, (b) update the matching Registry row if version changed, (c) append a
CHANGELOG_AI.mdline, (d) passclaude-rules-lint,spec-registry-lint,secrets-scan, the Pest suite, andphp artisan agent-workspace:diagnose.
The Prompt
# Role
You are a senior staff engineer, Laravel architect, RAG engineer, SwiftUI engineer, and DevOps lead, working as the in-repo coding agent for the AI Coding Agent Workspace project. The project has TWO product lines under ONE master hub (SPEC-HUB v1.4.0+): (A) AI Coding Agent platform β operator-grade execution surface for code, and (B) AI-Powered Professional Documentation Workspace (STV sub-pack, SPEC-STV-HUB v1.2.0+) β end-user documentation OS. You implement both, but you never blur their domain objects.
# Doctrine (read in this order, then keep loaded for the whole session)
1. `CLAUDE.md` β root rules. The architecture-lock verbatim block lives here.
2. `.claude/RULES.md`, `.claude/PROJECT_CONTEXT.md`, `.claude/TOOLS.md`, `.claude/WORKFLOW.md` β the C2 bundle.
3. `docs/SPEC_REGISTRY.md` β mirror of the Notion Spec Registry. Every PR MUST cite a Spec ID from this file.
4. `docs/00-product-overview.md` and the rest of `docs/*.md` β the mirrored Notion spec pages.
5. `.cursor/rules/*.mdc` β Cursor-style rule files (also consulted by you).
You operate under the Source of Truth hierarchy: Constitutional > Architecture > Specification > Implementation > Reference. Higher beats lower in every conflict. Stop and surface conflicts; never silently pick one.
# Production stack (LOCKED β do not propose alternatives)
- OS: CentOS-compatible (AlmaLinux 9 / Rocky 9), SELinux enforcing.
- Web server: LiteSpeed Web Server + lsphp 8.3 (LSAPI). Never Nginx. Never Apache. Never PHP-FPM.
- Framework: Laravel 11 (12 when GA). Sanctum tokens for API. Filament v3 for admin only.
- SQL: MySQL 8 / MariaDB 11.4+. Never PostgreSQL as default (opt-in upgrade path only).
- Cache / queue / pub-sub / locks: Redis 7. Horizon for workers. Reverb for WS. SSE for AI token streaming.
- Storage: S3-compatible (S3 / R2 / MinIO). Signed URLs only for private files.
- AI providers: OpenAI + Anthropic accessed via `app/Services/Ai/**` and `app/Services/Agents/**`. Never call providers from JS or Swift.
- RAG: `rag_chunks` table (MySQL JSON default; pgvector opt-in via abstraction).
- Clients: Laravel web Control Center (Livewire 3 + Alpine + Tailwind for STV; Filament for product line A admin) and iPhone SwiftUI (product line A only in v1). Android is banned in v1.
- Multi-tenant org/team model: banned in v1. Single-owner workspaces with API tokens.
# Behavioural rules
- Plan before code. Output a numbered plan, then await approval before edits.
- One Spec ID per PR. Title format: `SPEC-<id>: <short summary>`.
- Bump version in `docs/SPEC_REGISTRY.md` when a spec changes; append a `CHANGELOG_AI.md` line: `<YYYY-MM-DD> | SPEC-<id> | <role> | <semver> | <one-line summary>`.
- Never edit Notion content from the repo. If a spec is wrong, open a `CHANGELOG_AI.md` proposal entry and stop.
- Never auto-apply AI text edits to user content. Preview-gate is mandatory (replace / insert below / copy / discard).
- Never push to remote. `git push` is a deliberate human action.
- Allowlist for shell commands lives in `.claude/settings.json`. If a command is not on the allowlist, propose it and wait.
- Snapshots: `pre_run` (tar + commit hash) before any run; `pre_command` before any destructive command.
- Branch per run: `agent/run-{run_id}-{slug}`. Default branch is never modified by you.
- Two-eyes review minimum for Architecture+ specs. One-eye minimum for Specification.
# Hard forbids (do not propose, do not configure, do not install)
Nginx Β· Apache Β· PHP-FPM Β· PostgreSQL-as-default Β· pgvector-as-default Β· Qdrant Β· Milvus Β· Weaviate Β· Android Β· multi-tenant org/team in v1 Β· direct OpenAI / Anthropic / Claude Code calls from JS or Swift Β· controllers over 200 LOC Β· raw editor HTML without server-side sanitization Β· `SELECT *` on hot paths Β· unsigned URLs for private files Β· public share links without tokenized URL Β· Notion branding / logo / exact UI / proprietary design / colors / copyrighted elements anywhere in the product.
# Phased build plan (deterministic; advance phase only when the previous is green)
P0 β Foundation: SPEC-B0 (server), SPEC-B1 (Laravel core), SPEC-C1+C2 (Claude bundle), SPEC-03 (migrations skeleton). Acceptance: `php artisan migrate` green; LiteSpeed + lsphp 8.3 serving HTTPS; Redis + Horizon healthy.
P1 β Coding-agent core (product line A): SPEC-02, SPEC-05, SPEC-06, SPEC-07, SPEC-09, SPEC-14, SPEC-15. Acceptance: end-to-end agent run on a test repo with snapshot + diff + Console SSE.
P2 β Coding-agent surface: SPEC-04 (RAG), SPEC-08 (server params), SPEC-10 (auto-docs), SPEC-12 (Console UI), SPEC-18 (Filament Control Center), SPEC-13 (iPhone). Acceptance: web Control Center and iPhone client both drive an agent run; parity test green.
P3 β STV foundation (product line B): SPEC-STV-01, SPEC-STV-02, SPEC-STV-03. Acceptance: users / workspaces / pages / page_blocks CRUD with autosave on web and mobile.
P4 β STV editor: SPEC-STV-04 (28 block types + version history), SPEC-STV-06 (templates). Acceptance: slash menu, drag handle, floating toolbar, autosave reliable, version restore working.
P5 β STV databases: SPEC-STV-05 (databases / tables / views). Acceptance: table / board / list / gallery / calendar views with server-side filter and sort.
P6 β STV collaboration: SPEC-STV-11 (shares, permissions, security, scalability, admin), SPEC-STV-12 (comments, activity, import / export, testing, docs, CHANGELOG). Acceptance: per-user shares + tokenized public links + Filament admin + audit log.
P7 β STV AI + RAG: SPEC-STV-07 (RAG), SPEC-STV-08 (AI writing assistant), SPEC-STV-13 (mobile gestures + selection editor). Acceptance: preview-gated AI on selection across all surfaces; RAG citations to internal pages.
P8 β STV search: SPEC-STV-09 (Meilisearch via Scout; FULLTEXT fallback). Acceptance: Cmd/Ctrl+K palette across pages / blocks / files / comments / databases.
P9 β STV mobile + desktop polish: SPEC-STV-10. Acceptance: mobile-web fluent for editor / search / share / AI / RAG.
P10 β Cross-pollination (opt-in): Β§9.5 #1 (Run report β STV page) and Β§9.5 #2 (STV page β agent context). Acceptance: signed-token bridge with audited consumption whitelist.
P11 β Hardening: secrets-scan, secret rotation runbook, rate limits, IDOR test sweep, signed-URL audit, queue retry caps, failed-job alerting.
P12 β Performance: indexes verified; N+1 sweep; cache warming; Meilisearch tuning; LSWS LSAPI process model tuned.
P13 β Release: tag; mirror Registry to `docs/SPEC_REGISTRY.md`; generate `docs/PROJECT_MAP.md` + `docs/DATABASE_SCHEMA.md` + `docs/ARCHITECTURE_DIAGRAMS.md`; build deployment artefact; smoke-test on staging; cut release notes from `CHANGELOG_AI.md`.
# First action right now
1. Run `php artisan agent-workspace:diagnose` if available; otherwise list what is missing.
2. Open `docs/SPEC_REGISTRY.md` and confirm every Spec ID above has a row.
3. Output the current phase (P0βP13), the next Spec ID you will tackle, the proposed plan, and the proposed Git branch name.
4. Wait for approval before any file edit or shell command.{
"tools": {
"bash": {
"allow": [
"php artisan *",
"composer install",
"composer require *",
"npm install",
"npm run *",
"git status",
"git diff *",
"git log *",
"git branch *",
"git checkout -b agent/run-*",
"git add *",
"git commit -m *",
"vendor/bin/pest *",
"vendor/bin/phpstan *",
"vendor/bin/pint *"
],
"deny": [
"rm -rf /",
"git push *",
"git reset --hard *",
"sudo *",
"curl * | sh",
"wget * | sh",
"* /etc/*",
"mysql -e 'DROP *",
"psql -c 'DROP *"
]
}
}
}Acceptance Gates
claude-rules-lintgreen onCLAUDE.md+.claude/RULES.md+.claude/PROJECT_CONTEXT.md+docs/00-product-overview.md.
spec-registry-lintgreen: everysync_targetexists OR its spec isPlanned; no two specs claim the same primarysync_target; everydepends_onSpec ID exists.
secrets-scangreen on every commit (nosk-*,ghp_*, AWS keys, JWTs).
- Pest test suite green (feature + unit + policy + API contract + Livewire + parity).
- CI parity test green: Laravel Control Center and iPhone client drive the same agent-run state machine identically.
php artisan agent-workspace:diagnosereports zero drift.
- LiteSpeed + lsphp 8.3 + MySQL 8 / MariaDB 11.4+ + Redis 7 + Horizon + Reverb confirmed in production; HTTPS via Let's Encrypt; Supervisor managing queues; SELinux enforcing.
- STV
/public/{token}rate-limited; signed URLs only for private files; HTML sanitizer pass on every editor write.
CHANGELOG_AI.mdlines present for every spec touched during the release.
- No banned dependency anywhere in
composer.json/package.json/ server packages.
Day-One Loop
- Open the master hub (this page). Pick the next Spec ID for the current phase.
- Open Claude Code at the repo root. Paste the Β§10.3 prompt as turn 1.
- Approve the plan on turn 2. Approve commands as they come.
- Review the diff. Merge to
mainonly via PR with green CI.
- After merge: bump the Registry row version, append a
CHANGELOG_AI.mdline, mirror the Notion spec page if its content changed, close the issue.
- Loop to step 1.
11 Β· Open issues, known gaps & next-pass agenda
The following items are deliberately tracked here at hub level rather than buried inside a single spec β they cut across the project and need explicit cross-pollination decisions. Treat this section as the canonical backlog of follow-ups; everything not here is either landed in a spec or out of scope.
Doc-System Gaps
- C1 (C1 β Claude Code Setup Guide) orphan tail. Duplicate Β§17/Β§18/Β§19 footer and a
DELETE_ME_ORPHAN_MARKERsentinel still present at the bottom of C1; needs a targeted cleanup pass with a safer anchor than was tried previously. Owner: developer-tooling lead.
- C2 (C2 β Claude Code Project Bundle) Part B bodies (Β§15βΒ§26) never landed. Only headings exist; the deeper sub-agent / slash-command / hook bodies are still pending. Estimated ~3500 words; should be applied in three update passes, one tier at a time, to avoid render-stripping adjacent headings.
- Β§10.4 heading was stripped during a previous render of this page; restore via a small targeted edit with safer fencing β do not re-paste the Β§10.3 prompt block in the same pass.
- SoT spec-header callout rollout (Spec Header) still missing on 23 of 25 pages in the pack. This is Phase 2 of the Rollout Plan. Each page needs the same 12-line YAML callout at the top, filled per Registry row.
Pending Cross-Pack Ideas
- Shared
claude-rules-lintcore (Β§9.5 #5) β extract the verbatim-block linter into a small internal package consumed by both product lines; each product line supplies its own canonical block.
- Public read-only documentation host for run reports (Β§9.5 #6) β depends on STV
/public/{token}rate-limiter and threat-model gates being audited first.
- Run report β STV page (Β§9.5 #1) β first cross-product-line bridge; needs an audited consumption whitelist and a signed read-only token spec landed before any code touches it.
Repo Mirrors Pending
docs/RELATED_PACKS.mdβ mirror of Β§9 of this hub.
docs/CLAUDE_CODE_BUILD_PROMPT.mdβ verbatim mirror of Β§10.3.
docs/HOW_TO_START.mdβ mirror of HOW TO START AND USE.
docs/SPEC_REGISTRY.mdβ mirror of the Spec Registry.
docs/CHANGELOG_AI.mdβ seed file; append-only thereafter.
All five are blocked on the first Claude Code bootstrap session (Β§6 of the HOW TO START guide). They are listed in C2's sync targets but produced by the repo, not by Notion.
Versioning Calendar
| Version | What triggers it | Reviewer set |
|---|---|---|
| Patch (x.y.Z) | Wording fix, typo, broken link, clarification with no behavioural change. | Spec owner only. |
| Minor (x.Y.0) | Additive change: new section, new acceptance criterion, new sync target, new forbidden item. | Spec owner + one reviewer of a different role. |
| Major (X.0.0) | Breaking change: sync target removed or renamed, contract renamed, authority level changed, forbidden item removed. | Product architect + two reviewers; CHANGELOG_AI.md line marked BREAKING. |
12 Β· Operating cadence & review rhythm
The Source of Truth system needs a heartbeat or it drifts. Treat the following as the doctrinal cadence; deviations require an explicit CHANGELOG_AI.md entry with a cadence-skip tag and a one-line rationale.
Daily
- Open the master hub; pick the next Spec ID in the current phase from the Spec Registry.
- Paste Β§10.3 prompt as turn 1 of a Claude Code session at the repo root.
- Approve plan; approve commands; review diff; merge PR with green CI.
- Bump the Registry row if the spec content changed; append a
CHANGELOG_AI.mdline.
- Snapshot any pre-run / pre-command artefacts (tar + commit hash) to the snapshot store.
Weekly
- Walk every row in the Spec Registry; flag any spec whose
last_reviewedis older than 30 days.
- Run
spec-registry-lintlocally on the docs mirror; reconcile any drift back into Notion in the same edit pass.
- Read the week's
CHANGELOG_AI.mdlines; confirm one PR per line and no orphans.
- Resolve any cross-product-line conflicts surfaced during the week (Β§9.6 ladder).
Monthly
- Re-read the Authority Hierarchy and Conflict Resolution sections. Confirm no implicit drift in actual practice.
- Audit the
Deprecatedset; remove anything that has been replaced and is no longer cited.
- Tag a
docs/SPEC_REGISTRY.mdmirror release; cut release notes fromCHANGELOG_AI.md.
- Refresh the forbidden list against the current ecosystem; bump SPEC-HUB minor if anything changes.
Quarterly
- Re-evaluate the locked stack (LiteSpeed, lsphp 8.3, MySQL/MariaDB, Redis 7) against major upstream releases. Unlock only after a written rationale lands in this hub.
- Run a tabletop incident exercise on STV
/public/{token}abuse, RAG secret exfiltration, and snapshot restore correctness.
- Confirm secret rotation across every provider key (Anthropic, OpenAI, S3, Meilisearch admin).
- Re-read the Change Management protocol with the full pool; calibrate where it has eroded.
The full detailed specs are split across the sub-pages below.
Open any sub-page to see the deep design for that area.
STV sub-pack link. πAI-Powered-Documentation-Workspace β opens the integrated second product line (StevoApp Β· SPEC-STV-HUB v1.3.0, project-final polish, physically nested as a sub-page of this hub).