Skip to content

Add nine new feature modules with settings UI#61

Closed
Josh-wt wants to merge 15 commits intoaaditagrawal:mainfrom
Josh-wt:claude/setup-server-dev-V0Pu8
Closed

Add nine new feature modules with settings UI#61
Josh-wt wants to merge 15 commits intoaaditagrawal:mainfrom
Josh-wt:claude/setup-server-dev-V0Pu8

Conversation

@Josh-wt
Copy link
Copy Markdown

@Josh-wt Josh-wt commented Apr 12, 2026

What Changed

This PR introduces nine new feature modules with complete backend services, frontend stores, contract definitions, and a unified settings UI panel:

  1. Cost Tracking – Records token usage and costs per turn, manages budgets with alerting
  2. Audit Log – Structured activity logging with actor, category, and severity metadata
  3. CI/CD Integration – Tracks CI runs and manages feedback policies for automated responses
  4. Provider Routing – Multi-provider health tracking and intelligent routing with failover
  5. Pipelines – Multi-stage pipeline definition and execution with dependency ordering
  6. Workflows – Reusable workflow templates with variable substitution
  7. Task Decomposition – Breaks down prompts into hierarchical task trees
  8. Project Memory – Knowledge base with semantic search and indexing
  9. Presence – Real-time shared sessions with participant tracking and cursor sharing

Each module includes:

  • Service interface and implementation (*Service.ts)
  • Zustand store for frontend state management (*Store.ts)
  • Effect/RPC schema definitions (packages/contracts/src/*)
  • Database migrations for persistence
  • WebSocket RPC method bindings

A new Features Settings Panel (FeaturesPanels.tsx) provides a tabbed UI to view and manage all nine features with real-time event streaming.

Why

These modules provide foundational infrastructure for:

  • Observability: Cost tracking and audit logging for compliance and optimization
  • Reliability: Provider routing with health checks and failover strategies
  • Automation: CI integration and workflow templates for repeatable processes
  • Intelligence: Task decomposition and project memory for context-aware assistance
  • Collaboration: Presence tracking for shared development sessions

The modular design allows each feature to be independently enabled, configured, and monitored through a unified settings interface.

UI Changes

Added /settings/features route with a tabbed panel showing:

  • Cost & Tokens summary with budget tracking
  • Audit log with filtering and pagination
  • CI/CD pipeline status and feedback policies
  • Provider health and routing rules
  • Pipeline and workflow execution status
  • Task decomposition trees
  • Project memory search and indexing
  • Real-time presence and session sharing

Each tab streams live events and provides CRUD operations for its domain.

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included UI changes (new settings panel with 9 feature tabs)
  • Database migrations included for all persistent features

https://claude.ai/code/session_01BpwxjJ9XzBeAXjRp86E9Jr

Summary by CodeRabbit

New Features

  • Added comprehensive cost tracking system with budgets, spending summaries, and cost alerts
  • Added audit logging for activity tracking with searchable entries and event streaming
  • Added CI/CD integration with run tracking and feedback policies
  • Added provider routing with health monitoring and failover rules
  • Added pipeline definitions and execution with multi-stage workflow support
  • Added workflow templates for automation and execution
  • Added task decomposition to break down complex requests into manageable tasks
  • Added project memory for persistent information storage and retrieval
  • Added live collaboration with real-time presence and session sharing
  • Added follow-up queueing in chat with customizable behavior (steer/queue modes)
  • Added new Features settings panel to manage and monitor all new capabilities

claude and others added 15 commits April 10, 2026 04:55
Server:
- Add CostTracking, AuditLog, CI, ProviderRouter, TaskDecomposition,
  ProjectMemory, Presence, Pipeline, and Workflow services with full
  SQLite persistence (migration 020)
- Wire all services into server.ts using Layer.mergeAll / provideMerge
  to stay within TypeScript's 20-arg pipe limit
- Add comprehensive RPC handlers in ws.ts for all new services
- Add mock stubs in server.test.ts to satisfy test layer requirements

Client:
- Add contract schemas and types for all 9 feature domains
- Add client-side stores (costStore, auditStore, ciStore, etc.)
- Add Features settings panel (FeaturesPanels.tsx + route)
- Extend RPC client (wsRpcClient.ts) with new service methods

Queue/Steer follow-up behavior (inspired by upstream PR pingdotgg#1479):
- Add followUpBehavior: "steer" | "queue" setting to AppSettings
- Queue mode holds follow-up messages while a turn is running and
  auto-dispatches them when the turn settles (transition-based effect)
- Steer mode (default) sends messages immediately as before
- Cmd/Ctrl+Shift+Enter inverts behavior one-off in either mode
- ComposerQueuedFollowUpsPanel shows queued items with remove buttons
- Queue clears on thread switch; failed dispatches re-queue

https://claude.ai/code/session_01XF5adFusgTx5Fb1Qhc8MeC
…-plan

Parameterize SQL queries, add pagination guards, and refine presence/memory handling
feat: implement 11 feature services + queue/steer follow-up behavior
- Add thread.branch-from-checkpoint case to commandToAggregateRef in
  OrchestrationEngine.ts; the new command type uses sourceThreadId/
  newThreadId instead of threadId, causing TS2339 after we added
  ThreadBranchFromCheckpointCommand to the contracts union
- Simplify deleteTemplate in WorkflowService.ts to eliminate the
  unnecessary Effect.gen wrapper (TS5 message)
- Change error channel type in server.ts runServer from any to unknown
  to suppress TS28 anyUnknownInErrorContext warnings propagating through
  cli.ts and bin.ts

https://claude.ai/code/session_01XF5adFusgTx5Fb1Qhc8MeC
…heck

The anyUnknownInErrorContext lint rule (TS28) fires for both any and
unknown in the error channel. Changing the prior session's unknown to
never correctly models a fully-launched server layer (all typed errors
are handled internally; unhandled failures are fatal) and eliminates
the TS28 propagation through cli.ts, bin.ts, and cli.test.ts.

bun typecheck now exits 0 with only pre-existing TS32 informational
messages (Effect.runFork inside Effect, pre-existing upstream).

https://claude.ai/code/session_01Nxa3JfS5jZVHsnJmaaHvbW
fix: resolve typecheck/lint failures from feature-services PR
…rtup

Migration 020 created a memory_fts FTS5 virtual table and three triggers.
SQLite distributions without FTS5 support (Node.js built-in SQLite, some
Bun builds) fail the migration mid-way. Because the migration runs inside
the Effect setup layer that is composed with Layer.provideMerge alongside
makeRuntimeSqliteLayer, a migration failure causes the entire persistence
layer construction to fail — SqlClient is never registered in the Effect
context, so every downstream service reports the misleading error:

  Service not found: effect/sql/SqlClient

Fix:
- Drop the memory_fts virtual table, insert/delete/update triggers from
  migration 020 (no schema change is needed for already-run migrations
  since the tables were in the same transaction and will re-run cleanly
  on a fresh DB, and users who ran it successfully already have those
  tables harmlessly present)
- Replace the FTS5 MATCH query in ProjectMemoryService.search with
  three LIKE predicates across title, content, and tags columns
- Remove the FTS5 index rebuild from ProjectMemoryService.index
  (forceReindex becomes a no-op, which is fine for LIKE search)

bun typecheck passes (7/7 packages).

https://claude.ai/code/session_01Nxa3JfS5jZVHsnJmaaHvbW
fix: remove FTS5 dependency to fix SqlClient Service not found at startup
fix(server): provide sqlite client before migration setup
…9ckusd

Unify SQLite client import for bun/node and ensure setup layer receives SQLite client
…setup

Layer.provideMerge(self, that) feeds `that` into `self`. The `setup`
layer needs SqlClient.SqlClient (to run PRAGMAs and migrations), while
`makeRuntimeSqliteLayer` produces it. Having them swapped left `setup`
with no SqlClient in context, causing "Service not found: effect/sql/SqlClient".

Reverts the arg-order change introduced in f44e39f.

https://claude.ai/code/session_01BpwxjJ9XzBeAXjRp86E9Jr
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d0b82ac3-d423-4d47-bf34-692baccd2472

📥 Commits

Reviewing files that changed from the base of the PR and between 4e1917b and 339b635.

📒 Files selected for processing (48)
  • apps/server/src/audit/Services/AuditLogService.ts
  • apps/server/src/ci/Services/CIIntegrationService.ts
  • apps/server/src/cost/Services/CostTrackingService.ts
  • apps/server/src/memory/Services/ProjectMemoryService.ts
  • apps/server/src/orchestration/Layers/OrchestrationEngine.ts
  • apps/server/src/orchestration/Schemas.ts
  • apps/server/src/orchestration/decider.ts
  • apps/server/src/orchestration/projector.ts
  • apps/server/src/persistence/Layers/Sqlite.ts
  • apps/server/src/persistence/Migrations.ts
  • apps/server/src/persistence/Migrations/020_NewFeatureTables.ts
  • apps/server/src/pipeline/Services/PipelineService.ts
  • apps/server/src/presence/Services/PresenceService.ts
  • apps/server/src/routing/Services/ProviderRouterService.ts
  • apps/server/src/server.test.ts
  • apps/server/src/server.ts
  • apps/server/src/task/Services/TaskDecompositionService.ts
  • apps/server/src/workflow/Services/WorkflowService.ts
  • apps/server/src/ws.ts
  • apps/web/src/appSettings.ts
  • apps/web/src/auditStore.ts
  • apps/web/src/ciStore.ts
  • apps/web/src/components/ChatView.tsx
  • apps/web/src/components/chat/ComposerQueuedFollowUpsPanel.tsx
  • apps/web/src/components/settings/FeaturesPanels.tsx
  • apps/web/src/components/settings/SettingsSidebarNav.tsx
  • apps/web/src/costStore.ts
  • apps/web/src/memoryStore.ts
  • apps/web/src/pipelineStore.ts
  • apps/web/src/presenceStore.ts
  • apps/web/src/routeTree.gen.ts
  • apps/web/src/routes/settings.features.tsx
  • apps/web/src/routingStore.ts
  • apps/web/src/taskStore.ts
  • apps/web/src/workflowStore.ts
  • apps/web/src/wsRpcClient.ts
  • packages/contracts/src/auditLog.ts
  • packages/contracts/src/ciIntegration.ts
  • packages/contracts/src/costTracking.ts
  • packages/contracts/src/index.ts
  • packages/contracts/src/orchestration.ts
  • packages/contracts/src/pipelines.ts
  • packages/contracts/src/presence.ts
  • packages/contracts/src/projectMemory.ts
  • packages/contracts/src/routing.ts
  • packages/contracts/src/rpc.ts
  • packages/contracts/src/taskDecomposition.ts
  • packages/contracts/src/workflows.ts

📝 Walkthrough

Walkthrough

This PR introduces a comprehensive suite of nine domain services (audit logging, CI integration, cost tracking, project memory, pipelines, presence, provider routing, task decomposition, workflows) with database persistence, real-time event streaming, WebSocket RPC endpoints, web client state management, and a new settings UI panel for feature configuration and monitoring.

Changes

Cohort / File(s) Summary
Audit Log Service
apps/server/src/audit/Services/AuditLogService.ts, packages/contracts/src/auditLog.ts
Introduces AuditLogService with record, query, and streamEvents operations; defines domain schemas for audit entries, query inputs, and categorization/severity/actor types.
Cost Tracking Service
apps/server/src/cost/Services/CostTrackingService.ts, packages/contracts/src/costTracking.ts
Implements CostTrackingService with recordUsage, getSummary, setBudget, getBudgets, and streaming; triggers budget alerts when thresholds are met; defines cost/budget/alert schemas.
CI Integration Service
apps/server/src/ci/Services/CIIntegrationService.ts, packages/contracts/src/ciIntegration.ts
Adds CIIntegrationService with run status queries, run recording, rerun triggering, and feedback policies; includes schemas for CI runs, jobs, and policy configuration.
Project Memory Service
apps/server/src/memory/Services/ProjectMemoryService.ts, packages/contracts/src/projectMemory.ts
Implements ProjectMemoryService with add, search, forget, list, and index operations; manages relevance scoring and expiration; defines memory entry and search schemas.
Provider Router Service
apps/server/src/routing/Services/ProviderRouterService.ts, packages/contracts/src/routing.ts
Introduces ProviderRouterService for multi-provider routing rules, health tracking, and provider selection; includes failover policies and strategy kinds.
Pipeline Service
apps/server/src/pipeline/Services/PipelineService.ts, packages/contracts/src/pipelines.ts
Adds PipelineService with definition CRUD, multi-stage execution with dependency resolution, cancellation, and event streaming; stages transition through pending/running/completed states.
Workflow Service
apps/server/src/workflow/Services/WorkflowService.ts, packages/contracts/src/workflows.ts
Implements WorkflowService with template management and execution via pipeline integration; includes built-in template seeding and variable substitution.
Task Decomposition Service
apps/server/src/task/Services/TaskDecompositionService.ts, packages/contracts/src/taskDecomposition.ts
Introduces TaskDecompositionService for decomposing prompts into task trees with status tracking and execution; persists task hierarchies with JSON serialization.
Presence Service
apps/server/src/presence/Services/PresenceService.ts, packages/contracts/src/presence.ts
Adds PresenceService with in-memory participant tracking, cursor updates, session sharing, and real-time presence events; maintains color assignment and role-based access.
Database Migrations & Persistence
apps/server/src/persistence/Migrations/020_NewFeatureTables.ts, apps/server/src/persistence/Migrations.ts, apps/server/src/persistence/Layers/Sqlite.ts
New migration creates 9 tables (cost_entries, cost_budgets, audit_log, ci_runs, ci_feedback_policies, pipeline_definitions, pipeline_executions, task_trees, session_shares, memory_entries, routing_rules, workflow_templates); switches Bun SQLite client loader.
Orchestration Extensions
apps/server/src/orchestration/Layers/OrchestrationEngine.ts, apps/server/src/orchestration/Schemas.ts, apps/server/src/orchestration/decider.ts, apps/server/src/orchestration/projector.ts
Adds thread.branch-from-checkpoint command/event handling; decider validates checkpoint existence and emits thread.created + thread.branched-from-checkpoint; projector filters source thread state (messages, checkpoints, activities) up to checkpoint turnCount and applies to new thread.
Server Layer Integration
apps/server/src/server.ts, apps/server/src/server.test.ts
Wires all 9 services via IndependentFeaturesLive and PipelineAndWorkflowLive layer compositions; test layer provides mocks with Effect.die("not implemented") for all service methods.
WebSocket RPC Infrastructure
apps/server/src/ws.ts, apps/web/src/wsRpcClient.ts, packages/contracts/src/rpc.ts
Adds 40+ new WS_METHODS RPC definitions and corresponding client interfaces; wires service operations to RPC handlers; includes streaming subscriptions for all event types.
Web Client Stores
apps/web/src/{cost,audit,ci,routing,pipeline,workflow,task,memory,presence}Store.ts
Introduces 9 Zustand stores for feature state management; each store includes async RPC operations, event subscriptions, loading/error state, and domain-specific store slices.
Web Client Settings UI
apps/web/src/components/settings/FeaturesPanels.tsx, apps/web/src/components/settings/SettingsSidebarNav.tsx, apps/web/src/routes/settings.features.tsx, apps/web/src/routeTree.gen.ts
New "Features" settings panel with tabbed interface (Cost, Audit, CI, Routing, Pipelines, Workflows, Tasks, Memory, Presence); route registration via TanStack Router.
ChatView Follow-up Queuing
apps/web/src/components/ChatView.tsx, apps/web/src/components/chat/ComposerQueuedFollowUpsPanel.tsx, apps/web/src/appSettings.ts
Extends ChatView with queued follow-up support controlled by followUpBehavior setting (steer/queue); auto-dispatches queued items on turn settlement; Cmd/Ctrl+Shift+Enter inverts queue mode; new ComposerQueuedFollowUpsPanel displays and manages queue.
Contract Definitions
packages/contracts/src/{auditLog,ciIntegration,costTracking,projectMemory,pipelines,presence,routing,taskDecomposition,workflows}.ts, packages/contracts/src/index.ts, packages/contracts/src/orchestration.ts
Defines Effect Schema-based contracts for all 9 domains; adds ThreadBranchedFromCheckpointPayload to orchestration; exports all contract modules from main index.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client/Browser
    participant WSServer as WebSocket Server
    participant Service as Domain Service
    participant PubSub as PubSub (in-memory)
    participant DB as Database

    rect rgba(100, 150, 200, 0.5)
        Note over Client,DB: Unary RPC Operation Example (Cost Recording)
        Client->>WSServer: request (cost.recordUsage)
        activate WSServer
        WSServer->>Service: recordUsage(input)
        activate Service
        Service->>DB: INSERT INTO cost_entries
        activate DB
        DB-->>Service: entry created
        deactivate DB
        Service->>PubSub: publish (cost.entry)
        Service->>DB: SELECT matching budgets
        DB-->>Service: budgets
        Service->>DB: UPDATE budget spend
        DB-->>Service: updated
        Service->>PubSub: publish (cost.alert) [if threshold met]
        Service-->>WSServer: success (CostEntry)
        deactivate Service
        WSServer-->>Client: response
        deactivate WSServer
    end

    rect rgba(150, 100, 200, 0.5)
        Note over Client,PubSub: Stream Subscription Example
        Client->>WSServer: subscribe (cost.onEvent)
        activate WSServer
        WSServer->>PubSub: Stream.fromPubSub(pubsub)
        activate PubSub
        Note over PubSub: Service publishes event
        PubSub-->>WSServer: event (cost.entry | cost.alert | cost.budget.updated)
        WSServer-->>Client: stream (event)
        deactivate PubSub
        deactivate WSServer
    end

    rect rgba(200, 150, 100, 0.5)
        Note over Client,DB: Pipeline Execution Flow
        Client->>WSServer: request (pipeline.execute)
        activate WSServer
        WSServer->>Service: execute(pipelineId)
        activate Service
        Service->>DB: SELECT pipeline + stages
        DB-->>Service: stages with dependencies
        Service->>Service: topological sort
        Note over Service: For each stage (in dependency order)
        Service->>DB: UPDATE stage status → running
        Service->>PubSub: publish (stage.started)
        Service->>DB: UPDATE stage status → completed
        Service->>PubSub: publish (stage.completed)
        Service->>DB: UPDATE execution status
        Service->>PubSub: publish (pipeline.completed)
        Service-->>WSServer: success
        deactivate Service
        WSServer-->>Client: response
        deactivate WSServer
    end
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Possibly related PRs

Suggested labels

vouch:trusted, size:XXL

Poem

🐰 Nine services bloom, databases grow,
Real-time streams in a brilliant show,
From audit to presence, from tasks to cost,
Features now shine—no capability lost!
Checkpoints branch forth in threads anew,
The warren of features awaits you. 🌟

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

@github-actions github-actions bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XXL 1,000+ effective changed lines (test files excluded in mixed PRs). labels Apr 12, 2026
@Josh-wt Josh-wt closed this Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ effective changed lines (test files excluded in mixed PRs). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants