Skip to main content

RFC Review: Autonomous AI Agent Phase 2 — AI-Assisted Refinement

Companion review for phase-2-ai-assisted-refinement.md, produced by the rfc-reviewer skill. Lives beside the RFC; valid only for the RFC revision in reviewed_rfc_last_updated (2026-07-07 / 15aa71d). This is review cycle R1 — no prior review existed.

Executive Summary

  • Overall Score: 8.5/10
  • Rating: Agentic-Ready
  • RFC Type: full-stack
  • Sub-Type: new-feature (FE) + new-feature (BE)
  • Assessment Confidence: High
  • Applied Caps/Gates: none — every category ≥ 7.5; ACV/DIC/FMC/CNT all ≥ 8.5; deploy order specified; no cross-layer contract mismatch found
  • Implementation Readiness Verdict: PROCEED with notes — Chunks 1–8 are executable against the documented contract + a stub today; the real-upstream pass (Chunk 9) and end-to-end acceptance are gated on an external dependency the RFC honestly flags (OQ-1a: upstream refine-skill-pack deployment/gateway exposure unverified), not on any spec gap.
  • Report Path: chatbot/autonomous-ai-agent/rfcs/phase-2-ai-assisted-refinement-review.md
  • RFC Author: Dimas Fauzi Hidayat (PM), Eng co-author Eko Aprianto | Reviewed: 2026-07-08

Yes — an AI agent can read this RFC and produce correct implementation code for the backend proxy, the shared-builder extraction, and the Refine rail without a clarification meeting, for the ~90% of the work that does not touch the still-unverified upstream. This is one of the most rigorously grounded RFCs I have reviewed: I checked ~60 file:line / symbol / contract claims against the real chatbot, chatbot-fe, and qontak-designer working trees and every symbol, pattern, contract, and behavior it cites is real — the reconciliation notes, the "as-built" upstream contract, the surgical-patch guarantee, the stateless-BE decision, and the reuse-the-existing-PATCH apply path are all correct and internally consistent. The biggest strength is decision closure: 10/10 major decisions are Resolved with alternatives, rationale, consequences, and reversibility, each grounded in named code. The biggest gap is not in the spec but in the world: the feature is a thin proxy in front of a Data/ML endpoint whose deployment is unverified, and two genuinely open behavioral questions (OQ-11 multi-turn context carry-through, OQ-4 KB-patch policy) could cause rework. The one thing to fix before an agent runs the Reading Guide by line: the line-number citations have drifted since the 2026-07-05 grounding pass (notably AiAgentEditor.vue, now off by ~+85 lines) — symbols are correct, so a grep-first agent recovers, but the numbers are stale.


Quick Verdict

Why this RFC can be implemented agentically:

  • Every contract is pinned to real code: full BE↔FE request/response JSON (§2.4), TS interfaces with props/emits (§2.A), the exact seam for the shared-builder extraction (Decision 3), and a 9-chunk execution plan with per-chunk verifiable acceptance criteria and the actual bundle exec rspec / pnpm commands (§4.D, §4.C).
  • Failure handling is exhaustive and cross-layer-consistent: §3.A failure catalog, §3.A.1 branch catalog, §3.B/§3.C BE+FE error catalogs, and dedicated failure-path sequence diagrams. All 11 Mermaid diagrams parse.
  • Scope is bounded to the file: §2.I lists files to create, to modify (with reasons), and explicitly NOT to touch on both layers.

Why this RFC will cause agent guessing or rework:

  • The whole feature proxies an upstream endpoint that is documented but not verified deployed (OQ-1a) — an agent can build against the stub but cannot complete Chunk 9 or prove end-to-end behavior.
  • Line-number citations are stale (AiAgentEditor.vue ~+85, prototype ~+18) and two BE helper/middleware paths are one directory level off — an agent trusting the Reading Guide's exact lines lands in the wrong place.
  • The updated_capability_pack → real form-model field/label map (the FE differ + applyPendingData port) is deferred to implementation, and OQ-11 leaves the multi-turn context mechanism unconfirmed.

Findings Ledger (carry-forward)

IDSeverityFinding (one line)RFC locationStatusFirst seenResolved inEvidence / fix
REV-1majorLine-number citations drifted since authoring — AiAgentEditor.vue off ~+66…+86, prototype ~+18§2.0 Reading Guide / Source Verification / Design↔Code; §2.AopenR1Verified vs real repos: showPreview :3015→:3081, activeTab.value=2 :3652→:3738, handleSave :3692→:3778, file 5,416→5,529 lines; prototype rightRailTab :4066→:4084, ProposedChange :4021→:4039, .recommended-border-anim :9318→:9422. Symbols correct → grep-first agent recovers. Fix: re-ground numbers or cite by symbol + note these files drift.
REV-2minorTwo BE paths point one directory too deep§2.0 Source Verification (rows for authorization_helpers / ownership)openR1set_role/403 lives at app/api/frontend_service/helpers/authorization_helpers.rb:6–10 and Ownership at app/api/frontend_service/middlewares/ownership.rb:7 (shared FE-service scope), not under v2/ai_agent/{helpers,middlewares}/. Symbols/behavior correct. Fix: correct the two paths.
REV-3majorCore upstream dependency documented "as built" but deployment/gateway exposure UNVERIFIED§1 Dependencies; §2.4; §5 OQ-1a; §7openR1RFC's own §7 execution blocker. Chunks 1–8 unblocked; Chunk 9 real-upstream + end-to-end acceptance blocked. External gate, not a spec defect. Owner PM+Data/ML, due 2026-07-15.
REV-4majorMulti-turn context carry-through unconfirmed against single-POST upstream design§5 OQ-11; REFINE-S03/AC-1; §2.BopenR1RFC specifies flat re-send of last-10 chat_history, but OQ-11 openly doubts whether a follow-up ("now also handle the timeout case") actually carries prior-turn context. Agent builds the specified flat re-send; satisfying S03/AC-1 is unverified. Fix: confirm chat_history semantics/bounding with Data/ML before Chunk 9.
REV-5minorKB-affecting-patch policy on Apply undecided§5 OQ-4; REFINE-S02 apply pathopenR1Allow vector re-resolve vs reject KB-affecting patches is a product decision due before Closed Beta; doesn't block Chunks 1–8 but S02 apply behavior for a KB-referencing patch is unspecified until then. Also needs Data/ML to confirm which patches refine can even emit.
REV-6minorupdated_capability_pack → real form-model field/label map deferred to implementation§2.A; §2.0 Design↔Code (Accept→stage row)openR1The FE differ + applyPendingData port names the sources (useAgentStore.ts:79–86 AgentDetailConfig + prototype applyPendingData) but tabulates no explicit field/label map — the single largest "agent figures it out" surface. Derivable, but rework-prone. Fix: add an explicit field-map table to Detail 2.A.
REV-7minorInternal staleness — two spots still say REFINE-S01/AC-4 "needs PRD correction" after the PRD was corrected§1 Detail 1.A (AC-4 row); §3.A.1 branch catalogopenR1PRD v1.5/v1.5.1 already rewrote AC-4 to the as-built surgical-patch guarantee; the §1 reconciliation row correctly says "Corrected in PRD v1.5," but Detail 1.A and the branch catalog still read "AC-4 needs PRD correction." Fix: update both to "corrected in PRD v1.5.1."

Ledger summary: 7 open (0 blocker, 3 major, 4 minor), 0 fixed this cycle (first cycle), 0 accepted-risk. All still-open material findings are promoted to the RFC Open-Questions surface below by id. Note REV-3/REV-4/REV-5 already correspond to existing RFC OQ-1a/OQ-11/OQ-4 — this review confirms and cross-references them rather than minting parallel work.


PRD → RFC Traceability Matrix

Source PRD: ../prds/phase-2-ai-assisted-refinement.md (v1.5.1). The RFC carries a full bidirectional matrix in Detail 1.A + a per-story change map in Detail 1.C + a PRD-section coverage table. Verified complete.

PRD ElementRFC SectionCoverage
REFINE-S01/AC-1..4, ERR-1..2 (refine in natural language)Detail 1.A; §2.4; §2.A; §2.CFull
REFINE-S02/AC-1..3, ERR-1..2 (accept + save)Detail 1.A; §2.A; §2.H flow 2; §2.D/2.EFull
REFINE-S03/AC-1..3, ERR-1 (multi-turn)Detail 1.A; §2.B; §2.4 chat_historyFull — but AC-1 (context-aware follow-up) rests on OQ-11, mechanism unconfirmed (REV-4)
REFINE-S04/AC-1..3, ERR-1 (config audit)Detail 1.A; §2.4 "Config-audit turns"; success criterion 6; §4.C staging scenarioFull — reliability rests on OQ-1g (upstream complaint-free audit tuning)
REFINE-S01-NEG/NEG-1..2 (no legacy refine; no auto-apply)Detail 1.A; §2.4 status codes; §3.A.1Full
PRD §10 API placeholder ("resolved in RFC §2.4")§2.4Full — schemas resolved
PRD §12.1 semantic rollback (PaperTrail revert)§4.E rollback recipe step 2Full
PRD §13 events§3 Monitoring (mapped to Mixpanel + Rails.logger/Rollbar — no BE event bus exists, correctly reconciled)Full

Summary: 8 of 8 PRD story/rule groups fully covered, 0 partial, 0 missing. 0 RFC decisions without a PRD driver (scope is a strict subset of PRD §7). No FE↔BE scope contradiction found. One cross-artifact drift (REV-7): two RFC cells still say AC-4 "needs PRD correction" though the PRD already corrected it — the direction of drift is harmless (RFC is stricter/older-worded), but the internal inconsistency should be cleaned.


Scorecard

Full-Stack Scorecard (18 categories)

#CategorySourceScoreEvidence-Based Rationale
1PRT — PRD TraceabilityMerged9.0FE+BE: Detail 1.A forward+reverse, 1.C per-story change map, PRD §-coverage table; all 5 stories + composite ACs mapped; no cross-layer contradiction.
2TDC — Technical DecisionsMerged9.010-row decision index (1.B) + 7 full ADR blocks with options/rationale/consequences/reversibility; cross-layer decisions (options[] shape ADR-6, diff source ADR-7) resolved; each grounded in named code.
3CNT — Contract SpecificityFE8.5§2.A full TS interfaces (RefinePanelProps, RefineMessage, RefineOption, ProposedChange, RefinePendingData), emits, state ownership. Docked: field/label + pendingData→form-model map deferred (REV-6).
4SCB — Scope BoundariesFE9.0§2.I explicit create / modify (+reason) / NOT touched for both layers; shared-file impact called out (sync_to_ai_service.rb, AiAgentEditor.vue).
5DEP — DependenciesFE8.0§1 dependency table with owner/status/blocking; the one blocking dep (upstream) is flagged and Chunks 1–8 declared independent of it. Design refs present (Figma pending, prototype canonical).
6NFS — Non-FunctionalFE8.0Bundle ≤15 KB gzip, INP <200 ms for Accept, WCAG AA with ARIA/keyboard/prefers-reduced-motion (§3.E). Browser matrix = "repo status quo" (slightly soft).
7TPS — Test PlanFE8.5§4.C command table with what-it-proves; per-chunk acceptance in §4.D; E2E happy-path spec; seeded-2-flaw config-audit staging scenario.
8DMS — Data Model & SchemaBE8.0No new tables by design (ADR-4), justified; erDiagram of the touched existing slice; DDL N/A with the parameters jsonb migration cited (verified real). Appropriately complete for a stateless feature.
9ACV — API Contract & VersioningBE8.5§2.4 full request/response JSON, status-code matrix, error shape, upstream contract quoted verbatim, idempotency ("safe to repeat — writes nothing"), additive v2. Caveat: upstream contract is documented-not-deployed (REV-3).
10DIC — Data Integrity & ConsistencyBE8.5§2.D matrix — refine no-write spec-asserted (parameters/updated_at unchanged); apply reuses the existing txn + sync-rollback (update_ai_agent.rb:59–67, verified); §2.E collision map.
11FMC — Failure Mode CoverageMerged9.0§3.A merged catalog with a code-shape-consistency column, §3.A.1 branch catalog, §3.B BE + §3.C FE error catalogs, dedicated failure-path sequence diagrams. FE error handler matches BE {error:{messages:[]}} (verified useGenerateAgent.ts:79).
12CSS — Concurrency & ScalingBE7.5Human-paced volume argued; 60 s worker-hold consequence named with a rollout watch; single-flight per panel; rate limiting deferred to pre-GA (OQ-7) — the one soft spot, honestly flagged.
13SAS — Security & AuthorizationBE8.5§3 threat model (5 threats) + mitigations; input validation per field; no-v-html XSS rule; org-scoped tenancy; Role×Endpoint matrix; secrets reuse.
14ROL — Rollout & RollbackMerged8.5Deploy order BE-first with rationale; single flag gates both layers; §4.A compat matrix (all safe/degraded-safe); §4.E ordered rollback recipe incl. the Chunk-1 sync-regression canary; stop conditions.
15OBS — ObservabilityMerged8.5§3 maps PRD §13 events to FE Mixpanel + BE structured logs (reconciled to what actually exists — no BE event bus); alerts, dashboard, "3 am" runbook, PII-scrub rule. Both layers covered.
16SBC — Service Boundary & CouplingBE8.5Topology + per-service responsibility diagrams; synchronous thin-proxy posture matching the drafter; §2.F.1 responsibility-boundary matrix; no inbound webhooks (async mismatch deliberately avoided).
17CPA — Pattern AlignmentMerged8.0§2.0 patterns-to-follow (both layers, "Deviation? none"), existing-code anchors, Design↔Code map; snake_case passthrough convention verified. Docked to 8.0: an agent following the Reading Guide by line lands off (REV-1) and two paths are wrong (REV-2).
18CDG — Compliance & Data GovernanceBE7.5Triggered (PII in transit — tenant-pasted customer content). §3.D table: nothing stored, TLS-in-transit, content-scrub logging rule, UU-PDP processor basis unchanged. Open: upstream retention policy (OQ-1f).

Resource & Cost Advisory (non-blocking)

  • §4.F is honest and correct: no new pods/workers/infra; +2 lightweight SELECTs per turn; zero storage growth (stateless); cost center is upstream LLM tokens (Data/ML-owned), bounded on our side by the 10-turn history cap. No advisory concern affects the score.

Decision Closure Assessment

Decision Index

#DecisionStatusCritical Gaps
1Upstream applies patches (surgical-patch guarantee); BE thin passthroughResolvednone — consequence (invented ref caught at Save) is spelled out
2Apply reuses PATCH /v2/ai_agents/:id (no new write path)Resolvednone
3Extract SkillPackBuilder with pluggable vector resolverResolvedseam is concrete; risk mitigated by Chunk-1 byte-identical regression spec
4Stateless BE; FE owns threadResolvednone
5Synchronous proxy, 60 s timeout, no cache, no retryResolvedworker-hold consequence acknowledged
6Response options[] (1..3); legacy → 422Resolvednone — BE wraps upstream's single proposal
7FE diffs mapped capability_packs, not raw RFC-6902Resolveddiffer specified; field-map deferred (REV-6, an interface detail not a decision gap)
8Never auto-applyResolvedPRD Non-Goal 1
9No cachingResolvedfolded into Decision 5
10Legacy-agent guard → 422 not 404Resolvedrationale given

Aggregate: 10 of 10 decisions Resolved, 0 Partial, 0 Dangling. The open items in §5 are dependency verifications and deferred product decisions (KB policy, rate limiting, audit-prompt tuning), not unresolved technical decisions — correctly kept out of the ADR set.

Because every decision is Resolved, per-decision deep-dives are abbreviated (all ≥ 7.0). The only one worth a challenge note: Decision 3 (builder extraction) is the single change to shared Phase-1 code and thus the highest-blast-radius task; the RFC lands it alone as Chunk 1 behind a byte-identical request-body regression spec on the real sync_to_ai_service_spec.rb (verified to exist) — this is the correct de-risking and is directly agent-verifiable.


Cross-Layer Contract Verification

EndpointBackend Response SchemaFrontend Expected SchemaMatch?Gaps
POST /:id/refinedata.reply, data.options[].{id,label,description,recommended,patches,updated_capability_pack,warnings}, data.warnings (snake_case)useRefineAgent consumes snake_case directly; maps recommendedisRecommended, derives changes/pendingData from updated_capability_packYesDerivation-by-design (ADR-7), not a mismatch. capability_pack shape identical to GET /:id + generate responses the FE already parses (parseDetailResponse).
PATCH /:idexisting update_ai_agent_responseexisting useSaveAgent.buildPayloadYesUnchanged contract (verified: bot-automation-agents.update PATCH at :232–247).
upstream refine-skill-pack{status, reply, patches[], updated_skill_pack, warnings[]} — single proposal (skill_pack shape)BE SkillPackMapper parses the same skill_pack shape it already handles from draft-skill-pack; use case wraps into options:[one]Yes (on paper)The BE↔upstream contract is documented-not-deployed (REV-3) + fast-follow asks in OQ-1b/c/e.

Checks performed: casing ✓ (snake_case passthrough, repo convention verified) · nullability ✓ (empty options:[] path defined) · error shape ✓ (FE response._data.error.messages[0] matches BE Grape convention) · pagination n/a (single-turn RPC) · auth ✓ (reuses existing Http client creds).

Mismatches found: 0 — no ROL cap triggered.


Cross-Layer Rollout Compatibility Matrix

ScenarioFrontendBackendWorks?Notes
Pre-deploy (baseline)OldOldYescurrent state
Backend firstOldNewYesnew route unused; flag OFF
Frontend firstNewOldPartial (degraded-safe)tab hidden unless flag payload present; a raced call 404s into the error turn — avoided by BE-first order
Both deployed (target)NewNewYesflag ON = target
Backend rollbackNewOldPartial (degraded-safe)refine sends fail into retryable error turn; editor/save unaffected; flip flag OFF
Frontend rollbackOldNewYesendpoint idle

Deploy order: Backend first (explicit, with rationale). Incompatible scenarios: 0 hard "No" — the two Partials are degraded-safe and covered by the single-flag + BE-first plan. ROL uncapped.


End-to-End Data Flow

Flow: Refine turn → accept → save (traceable end-to-end from §2.1/§2.2/§2.H)

Tenant types message in Refine tab
→ FE: RefinePanel → useRefineAgent.refine() (truncate chat_history to last 10)
→ API: POST /v2/ai_agents/:id/refine
→ BE: Grape route (Ownership → set_role → flag gate) → UseCases::RefineAiAgent
→ FindBy(id, org_id) → engine_version==2 guard
→ Mappers::SkillPackBuilder (READ-ONLY vector resolver — no vector DB created)
→ Repositories::Refine (gather available_tools) → AiService::AiAgent#refine_skill_pack
→ Upstream: refine-skill-pack (LLM diagnose + surgical-patch apply) → {reply, patches, updated_skill_pack, warnings}
→ BE: SkillPackMapper per option → 200 {reply, options[], warnings} [NOTHING PERSISTED]
→ FE: differ builds ProposedChange[] → thread renders reply + option cards
→ Accept: applyPendingData → form model + aiChangedFields highlight + activeTab switch (NO HTTP)
→ Save: PATCH /v2/ai_agents/:id → txn { Update + PaperTrail version + SyncToAiService(:update) → PUT /ai-agent }
→ Side effects: BE logs (refine requested/succeeded); FE Mixpanel (refine_requested/succeeded/accepted/applied)

Gaps in flow: the full path is documented in one place (§2.H) and matches the sequence diagrams — no piecing-together required. The one under-specified hop is the updated_capability_pack → real AgentDetailConfig form-model write inside applyPendingData (REV-6): the field/label mapping is named-but-not-tabulated. Multi-turn context carry-through across turns is unverified (REV-4).


Agentic Readiness Deep-Dive

Vague Word Audit

Spec sections are unusually concrete (contracts, counts, timeouts, exact commands). No blocking vagueness. Minor: "tens of RPM org-wide" (§3) is an estimate not a budget — acceptable for a flag-gated feature; "Pixel tokens verified at design QA once frames land" (§3.E) defers contrast confirmation to design QA — acceptable. Total blocking vague words: 0.

Dangling Alternatives

0 in the spec body — every "Option A vs B(/C)" resolves to a stated Decision.

Task Decomposition Assessment

ChunkAcceptance CriteriaAssessment
1 BE builder extractionbyte-identical request body pre/post; read-only resolver asserts no create_vector_dbverifiable
2 BE flagpredicate true only when row enabled; absent→falseverifiable
3 BE client methodPOST to exact path + 60 s timeouts (mock)verifiable
4 BE Repositories::Refinebody matches §2.4 upstream schema for fixtureverifiable
5 BE use case + routefull status matrix; DB row unchanged; 5xx→422verifiable
6 FE service + composablehistory cap slices to 10; differ add/update/remove rows; abort on disposeverifiable
7 FE rail + panel5 UI states; Accept mutates form/highlights/tab, no HTTP; gate hides tabverifiable
8 FE analytics + i18nevents fire with count-only propsverifiable
9 both E2E + stagingE2E green; staging refine ≤10 s p95; save applies staged pack; PaperTrail +1blocked on real upstream (REV-3)

Chunks 1–8 have crisp, runnable acceptance criteria. Chunk 9 is the only externally-gated one.


Strengths

  • Verified grounding, not claimed grounding. I checked ~60 citations against the real chatbot/chatbot-fe/qontak-designer trees: update_ai_agent.rb full-merge + txn + CapabilityRefPresence macros, sync_to_ai_service.rb builders + resolve_capability_vector_store raising VectorStoreSyncError, skill_pack_mapper.rb COMPLETION_TYPE_MAP + Entities::AiAgent(engine_version: 2), the drafter's 60 s timeouts, has_paper_trail, the parameters jsonb migration, zero pre-existing refine code, and the prototype's ProposedChange/PendingData/acceptRefineOption + verbatim chip click-payloads — all real.
  • Decision closure is textbook (10/10 Resolved, §2 ADR blocks) and the reconciliation table (§1) turns external-doc contradictions into repo-wins-decisions with the correct call each time (PaperTrail-not-ai_agent_histories, page-not-modal, rail-already-exists, as-built-does-not-strip-refs).
  • Failure and rollout rigor (§3.A/§3.A.1/§3.B/§3.C + §4.A/§4.E): cross-layer error-shape consistency, a branch catalog, a flag-flip rollback with no deploy, and a Chunk-1 sync-regression canary. All 11 Mermaid diagrams parse.

Biggest Gaps

  • REV-3 (major, external): the feature is a proxy in front of an unverified-deployed upstream (§5 OQ-1a, §7). Nothing an agent writes can close this; it caps completion at Chunk 8 until Data/ML confirms deployment.
  • REV-4 (major): OQ-11 leaves the multi-turn context mechanism unconfirmed — REFINE-S03/AC-1 ("response reflects earlier context") is built as a flat last-10 re-send whose sufficiency the RFC itself doubts.
  • REV-1 (major, mechanical): stale line numbers across the Reading Guide / Source Verification / Design↔Code tables, worst in the 5,529-line AiAgentEditor.vue (~+85). Symbols correct, so recoverable — but the RFC presents these numbers as authoritative and they will misdirect a line-trusting agent.

Priority Actions

  1. §5 OQ-1a (REV-3) — get Data/ML to confirm refine-skill-pack is deployed and exposed at /qontak-ai-noncore-mrag/api/ai-agent/refine-skill-pack in staging/prod. This is the only thing between "build Chunks 1–8" and "flip §7 to yes." Nothing else blocks starting.
  2. §5 OQ-11 (REV-4) — confirm with Data/ML how chat_history must be structured/bounded so a follow-up turn actually inherits prior context; if a flat last-10 re-send is insufficient, REFINE-S03 needs a revised request shape before Chunk 9.
  3. §2.0 + §2.A (REV-1, REV-2, REV-6) — re-ground the line numbers (or switch to symbol-anchored citations and note that AiAgentEditor.vue/prototype drift), fix the two BE helper/middleware paths (app/api/frontend_service/{helpers,middlewares}/), and add an explicit updated_capability_packAgentDetailConfig field/label map to Detail 2.A.
  4. Detail 1.A + §3.A.1 (REV-7) — update the two "REFINE-S01/AC-4 needs PRD correction" cells to "corrected in PRD v1.5.1" so the RFC stops flagging an already-fixed drift.

Backend Contract Addendum

Endpoint Contract Details

EndpointMethod/PathAuthZRequest ContractResponse ContractError ContractIdempotency/VersioningStatus
RefinePOST /v2/ai_agents/:id/refineOwnership + set_role(owner/supervisor/admin) + flag ai_agent_refineuser_message 1..4000 (req), chat_history[] ≤10 (role enum + content 1..4000), trace opaque ≤8 KB (optional, omitted v1)data.reply (str), data.options[] 0..3 (id,label,description,recommended,patches,updated_capability_pack,warnings), data.warnings[]200/400/403/404/422 (not_autonomous_agent on legacy); shape {error:{messages:[]}}Safe-repeat (no write); v2 additiveComplete
Apply (reused)PATCH /v2/ai_agents/:idexistingexisting full-merge profile/capabilities/routingexisting update_ai_agent_response400 (CapabilityRefPresence), 422 (sync rollback)last-writer-wins full mergeComplete (unchanged)

Database Changes Details

ChangeTable/EntityDDL / Shape DiffData MigrationRollbackCompatibilityStatus
None (ADR-4)zero migrations; reads ai_agents.parameters (jsonb, existing) + ai_agent_tools; one system_preferences seed rownoneflag flip / PaperTrail restorefully additiveComplete

Implementation Readiness Checklist

Unblocked (agent can proceed)

  • PRD → RFC traceability complete
  • All technical decisions resolved with alternatives rejected
  • Failure modes handled per interaction with an error catalog (§3.A–C)
  • Configuration contract documented (§4.B: flag, path constant, timeouts, history cap with defaults)
  • Pattern alignment verified (§2.0) — modulo REV-1/REV-2 line/path drift
  • Rollout plan with flag + rollback (§4.A/§4.E)
  • Observability metrics + alerts (§3)
  • Task decomposition with per-chunk acceptance (§4.D)
  • FE interfaces / prop types specified (§2.A) — modulo REV-6 field-map
  • All UI states defined (§2.C) · a11y specified (§3.E) · perf budget quantified (§3)
  • Cross-layer contract verified (§2.G) · deploy order specified (BE-first) · rollout matrix has no hard "No" · E2E flow documented · single-flag coordination defined
  • No new schema; API contracts with full schemas + error taxonomy; txn/idempotency per write path; collision map; security/tenancy; migration/rollback; service boundary; compliance (PII-in-transit) handled

Blocked (must fix first)

  • REV-3 / OQ-1a — upstream refine-skill-pack deployment + gateway exposure unverified (blocks Chunk 9 + end-to-end acceptance only)
  • REV-4 / OQ-11 — multi-turn chat_history context semantics unconfirmed (risks REFINE-S03 rework)

Verdict: Ready to implement Chunks 1–8 now; 2 external/behavioral items gate Chunk 9 and full acceptance.


Task Manifest

The RFC specifies a 9-chunk plan (§4.D) that is complete and verifiable; reproduced with review annotations. No re-derivation needed.

OrderChunkFiles to Create/ModifyAcceptance CriteriaDependencies
1BE SkillPackBuilder extraction+use_cases/mappers/skill_pack_builder.rb (+spec); ~repositories/sync_to_ai_service.rb; ~repositories/sync_to_ai_service_spec.rbexisting sync specs green; byte-identical request-body snapshot; read-only resolver asserts no create_vector_dbNone
2BE flag predicateseed system_preferences rollout/ai_agent_refine; predicate (pattern system_preference.rb:41–51)predicate true only when enabled; absent→falseNone
3BE upstream client~lib/ai_service/ai_agent.rb add refine_skill_packPOST to exact path + 60 s timeouts (mock)None
4BE Repositories::Refine+repositories/refine.rbbody matches §2.4 upstream schema for fixture1,3
5BE use case + route + response model+use_cases/refine_ai_agent.rb, +models/refine_response.rb; ~ai_agents_controller.rbfull status matrix; DB row unchanged; 5xx→4222,4
6FE service + composable~endpoint.ts, ~bot-automation-agents.ts; +useRefineAgent.ts (+differ)history cap 10; differ rows correct; abort on dispose5 (contract)
7FE rail + panel~AiAgentEditor.vue; +RefinePanel.vue, +RefineOptionCard.vue5 states; Accept mutates form/highlights/tab, no HTTP; gate hides tab6
8FE analytics + i18nwire trackEvent; locale keysevents fire with count-only props7
9E2E + stagingPlaywright spec; staging runE2E green; ≤10 s p95; save applies staged pack; PaperTrail +11–8 + real upstream (blocked, REV-3)

Dangling Decisions Log

#DecisionLocationOwnerDeadline
None — all 10 ADR decisions Resolved§2

Open Questions

Still-open material findings, cross-referenced to the RFC's own §5 where they already exist. Promote by REV-n.

#QuestionCategorySeverity
REV-3 / OQ-1aIs upstream refine-skill-pack actually deployed + exposed via the noncore-mrag gateway path?DEP / ACVBlocking (for Chunk 9 + acceptance)
REV-4 / OQ-11How must chat_history be structured/bounded so follow-up turns carry prior context — is a flat last-10 re-send sufficient for REFINE-S03/AC-1?ACV / PRTImportant
REV-5 / OQ-4On Apply, allow KB-affecting patches (vector re-resolve) or reject them? Which patches can refine even emit?DIC / SCBImportant (before Closed Beta)
REV-1Re-ground or symbol-anchor the drifted line numbers (esp. AiAgentEditor.vue ~+85, prototype ~+18)CPAImportant
REV-6Tabulate the updated_capability_packAgentDetailConfig field/label map in §2.ACNTImportant
REV-2Correct the two BE helper/middleware paths (FE-service scope, not v2/ai_agent/)CPANice-to-have
REV-7Update the two "AC-4 needs PRD correction" cells (PRD already corrected)PRTNice-to-have
OQ-1gConfirm complaint-free config-audit prompts are tuned/tested (REFINE-S04 reliability)FMCImportant (before Closed Beta)
OQ-7Add per-org refine rate limiting before GACSSNice-to-have (before GA)

Evidence Notes

  • Grounding pass (highest impact on confidence): three parallel repo audits confirmed ~60 symbol/pattern/contract claims across chatbot, chatbot-fe, qontak-designer. Result: symbols/contracts all real → High confidence, top-band scores justified; line-number drift → REV-1, docked CPA to 8.0 rather than 9.0.
  • §2.4 APIs + §2.G contract verification — full BE↔FE and BE↔upstream schemas present and mutually consistent; drove ACV/DIC/FMC high; the only weakness is upstream deployment (REV-3), a dependency not a contract defect.
  • §5 Open Questions — unusually candid (13 items, several marked Resolved with dates). OQ-11 and OQ-4 are the two that carry real build risk; the rest are dependency verifications or deferred product calls. This candor is why the RFC scores as Agentic-Ready despite declaring itself §7 "not ready" — the not-ready is an external gate, correctly separated from spec completeness.
  • Mermaid — 11/11 blocks parse under @mermaid-js/mermaid-cli; confirms the RFC's own 2026-07-05 comment-log claim.
  • PRD (v1.5.1) — as-built corrections (PaperTrail, surgical-patch, rail-exists) already landed; RFC and PRD agree except the cosmetic REV-7 drift.

Review History

CycleDateReviewed RFC revision (last_updated / commit)ScoreVerdictFindings open → fixedNotes
R12026-07-082026-07-07 / 15aa71d8.5PROCEED with notes7 open (3 major, 4 minor), 0 fixedFirst cycle. Grounded against real BE/FE/designer repos — citations all real, line numbers drifted. Only true gate is external upstream deployment (OQ-1a).