Skip to content

feat(assistant): add governed file evidence - #350

Merged
kl3inIT merged 13 commits into
mainfrom
feat/assistant-file-evidence
Aug 11, 2026
Merged

feat(assistant): add governed file evidence#350
kl3inIT merged 13 commits into
mainfrom
feat/assistant-file-evidence

Conversation

@kl3inIT

@kl3inIT kl3inIT commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Scope

  • add governed Assistant file uploads backed by the existing Source ingestion lifecycle
  • bind up to three exact source revisions to a turn and enforce them as a hard retrieval/citation ceiling
  • require exact active-engine readiness before selected evidence can be used
  • preserve exact evidence bindings across retry and refuse generation when any selected file yields no usable evidence
  • expose reusable knowledge::evidence interfaces for Assistant and GraphRAG consumers
  • add the upload/status API contract, migration, UI flow, domain specifications, test matrices, decision, and release note
  • refine the composer by removing the visible character counter, aligning the client/server limit at 8,000 characters, and showing the effective default model ID

Verification

  • gradlew.bat --no-daemon clean test --no-parallel --console=plain — 105 tasks, green
  • focused Assistant validation and OpenAPI write/read verification — green
  • corepack pnpm --filter @orgmemory/web check:api — green
  • web unit tests — 32 files / 107 tests, green
  • web production build (Oxlint, TypeScript, Vite) — green
  • Assistant Playwright suite — 24/24, green with one worker
  • docs check and production build — green
  • mechanical source/migration floor — green
  • corepack pnpm release:check — green after the final main sync

UI approval

The project owner approved candidate tree bde47ee2c937a1fd7671095fbfb757f7b0dd7b8a after desktop/mobile review. The following approved UI paths are unchanged after merging current origin/main:

  • apps/web/src/features/assistant/api/chat-transport.ts
  • apps/web/src/features/assistant/assistant-evidence.ts
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • apps/web/test/e2e/assistant-pipeline.spec.ts

Sanitized screenshot SHA-256 values:

  • desktop dialog: 27dcce964da9e2b5dada8f575e61e19f48024149a2a711b02862b47002e58272
  • desktop ready: 3f754b8d16e101ff8e2553e6ba49cc9a64e6e36dbf51314c12292a5acbb56cd4
  • mobile dialog: ebb458bf264e7f06369e8e59f9290d6abb84fd6edba95e05509b0266f19c6c20
  • mobile ready: 9ed4d50de1904d8ce809226d360b45b313a1f892abb0067129969be2a31d1ff5

Known limits

  • MVP supports durable governed Knowledge only; transient/provider-direct attachments remain intentionally unavailable.
  • Selected files must finish canonical ingestion and the exact active GraphRAG projection before submission.
  • The composer guard is character-based rather than provider-token-aware.

Summary by CodeRabbit

  • New Features
    • Added governed file attachments to Assistant conversations, supporting up to three documents per turn.
    • Added upload, readiness tracking, removal, retry preservation, and conversation evidence management.
    • Assistant responses now restrict retrieval to selected, permission-verified files and cite usable evidence.
    • Increased the Assistant message limit to 8,000 characters.
  • Bug Fixes
    • Attachments are disabled when no authorized Knowledge Space is available or selected files are unavailable.
    • Improved recovery when evidence processing temporarily fails or remains in progress.
  • Documentation
    • Documented governed file evidence workflows and API endpoints.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@kl3inIT, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 05f90cf9-f508-47bc-ac27-b55339a71e9c

📥 Commits

Reviewing files that changed from the base of the PR and between de39650 and da03be0.

⛔ Files ignored due to path filters (2)
  • docs/specs/domains/assistant-and-mcp.md is excluded by !docs/**
  • docs/tests/domains/assistant-and-mcp.md is excluded by !docs/**
📒 Files selected for processing (27)
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/authorization/AuthorizedEvidenceScope.java
  • components/graph-rag-core/src/main/java/com/orgmemory/graphrag/authorization/PermissionScopedGraphMerger.java
  • components/graph-rag-core/src/test/java/com/orgmemory/graphrag/cache/CacheKeyContractTests.java
  • components/graph-rag-testkit/src/main/java/com/orgmemory/graphrag/testkit/InMemoryAuthorizedQueryProjection.java
  • components/graph-rag-testkit/src/main/java/com/orgmemory/graphrag/testkit/InMemoryContentStore.java
  • components/graph-rag-testkit/src/test/java/com/orgmemory/graphrag/testkit/LightRagQueryRuntimeConformanceTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/ResolvedKnowledgeEvidenceScope.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/SecureKnowledgeRetrievalStore.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/CanonicalHybridKnowledgeSearchTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/GraphRagKnowledgeRetrievalServiceTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/SecureKnowledgeRetrievalStoreTests.java
  • integrations/graph-rag-neo4j/src/main/java/com/orgmemory/graphrag/neo4j/Neo4jGraphStore.java
  • integrations/graph-rag-neo4j/src/main/java/com/orgmemory/graphrag/neo4j/Neo4jProjectionSupport.java
  • integrations/graph-rag-opensearch/src/main/java/com/orgmemory/graphrag/opensearch/OpenSearchLexicalIndex.java
  • integrations/graph-rag-opensearch/src/main/java/com/orgmemory/graphrag/opensearch/OpenSearchStagedIndex.java
  • integrations/graph-rag-opensearch/src/main/java/com/orgmemory/graphrag/opensearch/OpenSearchVectorIndex.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeBatchTopology.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/ApacheAgeGraphStore.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresAuthorizedGraphSql.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresContentStore.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresGraphStore.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresLexicalIndex.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresProjectionSupport.java
  • integrations/graph-rag-postgres/src/main/java/com/orgmemory/graphrag/postgres/PostgresVectorIndex.java
  • integrations/graph-rag-postgres/src/test/java/com/orgmemory/graphrag/postgres/PostgresAuthorizedGraphSqlTests.java
📝 Walkthrough

Walkthrough

The PR adds governed Assistant file evidence. The API, core services, retrieval paths, database schema, web composer, documentation, and tests support upload, readiness checks, ordered evidence selection, restricted retrieval, and citation validation.

Changes

Governed file evidence

Layer / File(s) Summary
Evidence contracts and Source Ledger integration
ARCHITECTURE.md, core/src/main/java/com/orgmemory/core/knowledge/evidence/*, core/src/main/java/com/orgmemory/core/knowledge/sourceledger/*, core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql
Adds governed upload and evidence contracts. Source Ledger returns source and revision identity. Database tables store conversation bindings and ordered turn selections.
Assistant evidence binding and turn claims
core/src/main/java/com/orgmemory/core/assistant/AssistantEvidence*, core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java, core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBinding*
Adds actor-scoped binding creation, listing, status evaluation, readiness checks, and ordered evidence claims.
Readiness and restricted retrieval
core/src/main/java/com/orgmemory/core/knowledge/graph/*, core/src/main/java/com/orgmemory/core/knowledge/retrieval/*, core/src/main/java/com/orgmemory/core/knowledge/search/*, core/src/main/java/com/orgmemory/core/assistant/AssistantService.java, apps/api/src/main/java/com/orgmemory/api/assistant/AssistantConfiguration.java
Adds GraphRAG answerability states. Canonical and GraphRAG retrieval restrict assets and verify exact source, revision, and asset identity.
Evidence API and Assistant composer
apps/api/src/main/java/com/orgmemory/api/assistant/*, apps/web/src/features/assistant/*, apps/web/src/features/sources/components/source-upload-dialog.tsx
Adds evidence endpoints and chat transport fields. The composer uploads files, polls readiness, preserves selections across retries, blocks unavailable evidence, and sends binding IDs. The message limit increases to 8,000 characters.
Validation, documentation, and integration coverage
apps/docs/content/docs/reference/api-reference/assistant.mdx, apps/api/src/test/*, apps/web/test/e2e/assistant-pipeline.spec.ts, core/src/test/*, .tegami/*
Adds OpenAPI, unit, retrieval, Modulith, browser, and release-note coverage for governed evidence, readiness, ordering, retry behavior, authorization, and message limits.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant AssistantComposer
  participant AssistantController
  participant AssistantEvidenceService
  participant RetrievalService
  participant ChatModel
  User->>AssistantComposer: Upload and select governed files
  AssistantComposer->>AssistantController: POST evidence multipart request
  AssistantController->>AssistantEvidenceService: Create binding
  AssistantEvidenceService-->>AssistantComposer: Binding status
  User->>AssistantComposer: Submit chat message
  AssistantComposer->>AssistantController: Chat request with binding IDs
  AssistantController->>AssistantEvidenceService: Claim ordered evidence
  AssistantEvidenceService-->>AssistantController: Restricted selection
  AssistantController->>RetrievalService: Search with evidence selection
  RetrievalService-->>AssistantController: Permission-verified evidence
  AssistantController->>ChatModel: Generate grounded response
Loading

Possibly related PRs

  • kl3inIT/OrgMemory#40: Extends the Assistant and GraphRAG evidence retrieval flow with governed file evidence.
  • kl3inIT/OrgMemory#266: Extends the retrieval contracts and implementations with evidence-scoped selection.
  • kl3inIT/OrgMemory#333: Modifies the same Assistant message-length paths while changing the limit to 8,000 characters.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.70% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly states the scope, verification results, documentation work, UI approval, and known limits, although it uses Scope instead of Summary.
Title check ✅ Passed The title is concise and clearly identifies the main change: governed file evidence for the Assistant.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/assistant-file-evidence

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Tegami

This repository uses Tegami to manage releases. When your changes affect published packages, add a changelog file under .tegami/ before merging.

Create a changelog → · Changelog format

Release preview

Package Bump Version
orgmemory minor 0.2.00.3.0

Changelogs in this PR

Changelog Title
2026-08-10-assistant-governed-file-evidence.md Features
2026-08-10-assistant-governed-file-evidence.md Security

Run pnpm run tegami locally to create a changelog interactively.

Managed by Tegami.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/web/src/features/sources/components/source-upload-dialog.tsx (1)

39-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Narrow trigger to ReactElement | false.

DialogTrigger uses Radix asChild, which requires a single React element child so props and ref can be cloned/forwarded onto it. Allowing only the default button or explicitly omitted false matches the current runtime behavior.

♻️ Proposed prop type
-import { useState, type FormEvent, type ReactNode } from "react"
+import { useState, type FormEvent, type ReactElement, type ReactNode } from "react"
-  trigger?: ReactNode | false
+  trigger?: ReactElement | false
   description?: ReactNode
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/web/src/features/sources/components/source-upload-dialog.tsx` around
lines 39 - 51, Update the `trigger` prop in the component props definition to
accept only `ReactElement | false` instead of `ReactNode | false`, preserving
support for the default trigger and explicit omission while ensuring
`DialogTrigger` receives a single clonable element.
core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java (1)

136-149: 🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win

One audit reason now covers two different authorization outcomes in both retrieval engines. Both engines narrow the resolved authorized-asset scope by KnowledgeEvidenceSelection, then reuse the pre-existing NO_AUTHORIZED_KNOWLEDGE_ASSETS reason when the narrowed scope is empty. An auditor can no longer separate "the actor has no authorized Knowledge" from "the actor may not view the selected files". Add one new reason code for the selection-narrowed case and use it in both engines.

  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java#L136-L149: record whether retainAll(selection.assetIds()) emptied a previously non-empty set, then pass the selection-specific reason to searchAudit at Line 146.
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java#L392-L412: apply the same distinction around the restrict(resolve(...), selection) result, and pass the selection-specific reason to searchAuthorization.command at Line 409.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java`
around lines 136 - 149, Introduce a selection-specific authorization audit
reason and use it in both retrieval engines. In
core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java#L136-L149,
track whether retainAll(selection.assetIds()) empties a previously non-empty
authorizedAssetIds set, then pass the new reason to searchAudit; retain
NO_AUTHORIZED_KNOWLEDGE_ASSETS when the resolved scope was already empty. Apply
the same distinction to the restrict(resolve(...), selection) result in
core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java#L392-L412
and pass the selection-specific reason to searchAuthorization.command.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java`:
- Around line 211-228: In the retrievalScheduler callback within
AssistantController, collapse the ternary’s duplicated assistant.startTurn calls
into one invocation that always passes turnClaim.selection() as the final
argument, relying on the overload’s unrestricted default behavior only where
appropriate.

In `@apps/docs/content/docs/reference/api-reference/assistant.mdx`:
- Around line 49-51: Update the assistant API reference page metadata by setting
lastReviewed to 2026-08-10 using the existing Asia/Bangkok date convention,
while preserving the documented governed-evidence navigation entries.

In `@apps/web/src/features/assistant/components/assistant-page.tsx`:
- Around line 944-972: Update the evidence-chip header rendered by the
currentEvidenceBindings block to act as an appropriate live region so assistive
technology announces status changes without disrupting keyboard interaction.
Replace binding.status?.toLowerCase() with the existing human-readable
status-label mapping or equivalent product-facing labels, including indexing and
unavailable, while preserving the current loading, disabled, and removal
behavior.
- Around line 660-682: Update the evidence polling flow in useQueries so
refetchInterval continues while each binding is not in a terminal state,
including failed requests with no data, rather than stopping when
query.state.data is undefined. Use the existing terminal/readiness status logic
around assistantEvidenceReady to preserve normal completion behavior. In the
evidence-binding UI, use evidenceStatusQueries[index]?.isError to render a
visible error message explaining why sending remains blocked.
- Around line 854-868: Move evidenceBindingIdsRef.current synchronization into a
useEffect dependent on evidenceBindings, and remove the ref assignments from the
setEvidenceBindings updater functions in addEvidence and removeEvidence.
Preserve the existing ID filtering behavior.

In
`@core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java`:
- Around line 67-73: Update AssistantConversationService.requireUserMessage to
accept normalized user messages up to 8,000 characters, matching
AssistantChatRequest and the web assistant constraint while preserving
assistant.message-invalid for longer or invalid content. Extend tests covering
both evidence and non-evidence turn flows, including messages between 4,001 and
8,000 characters.

In
`@core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceService.java`:
- Around line 195-226: Move the CAN_VIEW authorization in the evaluation flow
before the source-state branches, using the knowledgeAssetId when available and
failing closed to UNAVAILABLE with failureCode cleared when access is denied.
Ensure view(binding, source, ...) cannot expose title, fileName, or failureCode
from the UNAVAILABLE, FAILED, or PROCESSING paths without authorization;
explicitly preserve the chosen fail-closed behavior for pre-asset sources where
knowledgeAssetId is null.

In
`@core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql`:
- Around line 58-63: Update the fk_assistant_turn_evidence_binding foreign key
in the migration so deleting an assistant_evidence_bindings row cannot delete
its assistant turn evidence selection. Replace the ON DELETE CASCADE behavior
with ON DELETE NO ACTION and preserve the existing composite reference columns.

In
`@core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceServiceTests.java`:
- Around line 75-102: Expand
AssistantEvidenceServiceTests.claimsOnlyTheExactReadyRevisionAndPersistsTheTurnSelection()
to use multiple binding IDs, return repository bindings in a different order,
capture turnBindings.saveAll, and assert the saved binding IDs, ordinals,
turnId, and userMessageId match the request order. In
apps/web/test/e2e/assistant-pipeline.spec.ts lines 355-380, upload and select at
least two files and assert evidenceBindingIds preserves the visible selection
order.

---

Outside diff comments:
In `@apps/web/src/features/sources/components/source-upload-dialog.tsx`:
- Around line 39-51: Update the `trigger` prop in the component props definition
to accept only `ReactElement | false` instead of `ReactNode | false`, preserving
support for the default trigger and explicit omission while ensuring
`DialogTrigger` receives a single clonable element.

In
`@core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java`:
- Around line 136-149: Introduce a selection-specific authorization audit reason
and use it in both retrieval engines. In
core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java#L136-L149,
track whether retainAll(selection.assetIds()) empties a previously non-empty
authorizedAssetIds set, then pass the new reason to searchAudit; retain
NO_AUTHORIZED_KNOWLEDGE_ASSETS when the resolved scope was already empty. Apply
the same distinction to the restrict(resolve(...), selection) result in
core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java#L392-L412
and pass the selection-specific reason to searchAuthorization.command.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 00eb9b69-fbed-4e48-ae4e-505aa548d750

📥 Commits

Reviewing files that changed from the base of the PR and between 6efb394 and fb44055.

⛔ Files ignored due to path filters (13)
  • apps/docs/generated/openapi.public.json is excluded by !**/generated/**
  • contracts/openapi.json is excluded by !contracts/openapi.json
  • docs/decisions/0038-use-governed-source-bindings-for-assistant-files.md is excluded by !docs/**
  • docs/increments/active/2026-08-10-assistant-file-evidence/challenge-brief.md is excluded by !docs/**
  • docs/increments/active/2026-08-10-assistant-file-evidence/challenge-verdict.md is excluded by !docs/**
  • docs/increments/active/2026-08-10-assistant-file-evidence/design.md is excluded by !docs/**
  • docs/increments/active/2026-08-10-assistant-file-evidence/plan.md is excluded by !docs/**
  • docs/increments/active/2026-08-10-assistant-file-evidence/reference-study.md is excluded by !docs/**
  • docs/roadmap.md is excluded by !docs/**
  • docs/specs/domains/assistant-and-mcp.md is excluded by !docs/**
  • docs/specs/domains/knowledge-ingestion.md is excluded by !docs/**
  • docs/tests/domains/assistant-and-mcp.md is excluded by !docs/**
  • docs/tests/domains/knowledge-ingestion.md is excluded by !docs/**
📒 Files selected for processing (59)
  • .tegami/2026-08-10-assistant-governed-file-evidence.md
  • ARCHITECTURE.md
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantChatRequest.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantConfiguration.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
  • apps/api/src/test/java/com/orgmemory/api/OpenApiContractTests.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantChatRequestValidationTests.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java
  • apps/docs/content/docs/reference/api-reference/assistant.mdx
  • apps/web/src/features/assistant/api/chat-transport.ts
  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/src/features/assistant/assistant-evidence.ts
  • apps/web/src/features/assistant/assistant-message-constraints.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceAnswerabilityPort.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBinding.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBindingRepository.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBindingView.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceService.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceStatus.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceTurnClaim.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceUploadService.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantService.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBinding.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBindingRepository.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedEvidenceQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedEvidenceRef.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUpload.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUploadCommand.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUploadResult.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerability.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerabilityQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/ResolvedKnowledgeEvidenceScope.java
  • core/src/main/java/com/orgmemory/core/knowledge/search/KnowledgeEvidenceSelection.java
  • core/src/main/java/com/orgmemory/core/knowledge/search/PermissionAwareKnowledgeSearch.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceLedgerGovernedEvidenceQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceLedgerGovernedFileUpload.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadRegistrationService.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadResult.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadService.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/package-info.java
  • core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql
  • core/src/test/java/com/orgmemory/core/ModulithVerificationTests.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceServiceTests.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceUploadServiceTests.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantServiceTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerabilityQueryTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/CanonicalHybridKnowledgeSearchTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/GraphRagKnowledgeRetrievalServiceTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadServiceTests.java
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: PostgreSQL GraphRAG
  • GitHub Check: Public docs · Node 24
  • GitHub Check: Backend · Java 25
  • GitHub Check: Web · Node 24
🧰 Additional context used
📓 Path-based instructions (11)
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Treat the repository and runtime evidence as the engineering system of record; do not treat chat or Northstar as authoritative.
Before changing a domain, read its specification, test-coverage document, and applicable decision filenames.
Material decisions about domain boundaries, authorization, persistence, publication, concurrency, cache isolation, parity scope, or deployment require an independent architecture challenge and documented alternatives before implementation.
Do not use completed increment documents as the source for current behavior; use them only for history or archaeology.
Before using unfamiliar Spring Boot, Spring Modulith, Spring AI, Gradle, React, Vite, Tailwind, TypeScript, Next.js, or Fumadocs APIs, consult current official documentation, Context7, and the relevant verification skill.
Read docs/guidelines/agent-safety.md before retrieval, AI, MCP, permission, upload, graph, or export work; never commit secrets or customer data.
Keep ddl-auto=validate and pair every persisted-model change with a Flyway migration.
Use the testing harness; a terminating clean test is the JVM context gate, and bootRun is not verification.

Files:

  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/package-info.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceStatus.java
  • apps/web/src/features/assistant/assistant-message-constraints.ts
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUpload.java
  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/GraphRagKnowledgeRetrievalServiceTests.java
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUploadCommand.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerability.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedEvidenceQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadRegistrationService.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceLedgerGovernedFileUpload.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBindingView.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceServiceTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerabilityQueryTests.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceTurnClaim.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedEvidenceRef.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadResult.java
  • core/src/main/java/com/orgmemory/core/knowledge/search/KnowledgeEvidenceSelection.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceUploadServiceTests.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBindingRepository.java
  • core/src/test/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadServiceTests.java
  • ARCHITECTURE.md
  • core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBinding.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/package-info.java
  • apps/api/src/test/java/com/orgmemory/api/OpenApiContractTests.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBindingRepository.java
  • apps/web/src/features/assistant/api/chat-transport.ts
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/CanonicalHybridKnowledgeSearchTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerabilityQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadService.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceLedgerGovernedEvidenceQuery.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceAnswerabilityPort.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUploadResult.java
  • apps/docs/content/docs/reference/api-reference/assistant.mdx
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceUploadService.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantChatRequest.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/ResolvedKnowledgeEvidenceScope.java
  • apps/web/src/features/assistant/assistant-evidence.ts
  • core/src/main/java/com/orgmemory/core/assistant/AssistantService.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantServiceTests.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantConfiguration.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantChatRequestValidationTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/search/PermissionAwareKnowledgeSearch.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBinding.java
  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceService.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java
  • apps/web/src/features/assistant/components/assistant-page.tsx
  • core/src/test/java/com/orgmemory/core/ModulithVerificationTests.java
**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

Apply IDE inspection only to edited backend Java files.

Files:

  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/package-info.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceStatus.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUpload.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/GraphRagKnowledgeRetrievalServiceTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUploadCommand.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerability.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedEvidenceQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadRegistrationService.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceLedgerGovernedFileUpload.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBindingView.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceServiceTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerabilityQueryTests.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceTurnClaim.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedEvidenceRef.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadResult.java
  • core/src/main/java/com/orgmemory/core/knowledge/search/KnowledgeEvidenceSelection.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceUploadServiceTests.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBindingRepository.java
  • core/src/test/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadServiceTests.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBinding.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/package-info.java
  • apps/api/src/test/java/com/orgmemory/api/OpenApiContractTests.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBindingRepository.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/CanonicalHybridKnowledgeSearchTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerabilityQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadService.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceLedgerGovernedEvidenceQuery.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceAnswerabilityPort.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUploadResult.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceUploadService.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantChatRequest.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/ResolvedKnowledgeEvidenceScope.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantService.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantServiceTests.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantConfiguration.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantChatRequestValidationTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/search/PermissionAwareKnowledgeSearch.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBinding.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceService.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java
  • core/src/test/java/com/orgmemory/core/ModulithVerificationTests.java
core/src/main/java/com/orgmemory/core/{authorization,knowledge,permission}/**/*.java

⚙️ CodeRabbit configuration file

core/src/main/java/com/orgmemory/core/{authorization,knowledge,permission}/**/*.java: Treat PostgreSQL ACL evidence as canonical and OpenFGA as the relationship
authorization decision point. Authorization must fail closed. Filtering
must happen before ranking, LIMIT, graph traversal, answer generation,
export, and citation rendering. Flag metadata or timing leak paths.

Files:

  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUpload.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUploadCommand.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerability.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedEvidenceQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadRegistrationService.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceLedgerGovernedFileUpload.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedEvidenceRef.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadResult.java
  • core/src/main/java/com/orgmemory/core/knowledge/search/KnowledgeEvidenceSelection.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/package-info.java
  • core/src/main/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerabilityQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadService.java
  • core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceLedgerGovernedEvidenceQuery.java
  • core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUploadResult.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/ResolvedKnowledgeEvidenceScope.java
  • core/src/main/java/com/orgmemory/core/knowledge/search/PermissionAwareKnowledgeSearch.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.{ts,tsx}: Extend the established OrgMemory product shell, design tokens, shadcn/Radix primitives, and existing layout patterns; do not introduce a separate visual system in the web application.
Generate ordinary REST clients from contracts/openapi.json using Hey API.
Use TanStack Query for server state, TanStack Router for navigation, and limit Zustand to durable or high-frequency UI state.
Preserve keyboard accessibility, light/dark theme support, loading and error states, and responsive behavior in the web application.

Files:

  • apps/web/src/features/assistant/assistant-message-constraints.ts
  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/src/features/assistant/api/chat-transport.ts
  • apps/web/src/features/assistant/assistant-evidence.ts
  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Frontend changes must pass lint, typecheck, tests, and a production build; perform browser verification when the flow warrants it.

Files:

  • apps/web/src/features/assistant/assistant-message-constraints.ts
  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/src/features/assistant/api/chat-transport.ts
  • apps/web/src/features/assistant/assistant-evidence.ts
  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
apps/web/src/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/web/src/**/*.{ts,tsx}: OAuth access and refresh tokens must never enter browser JavaScript or
browser storage. Use the HttpOnly BFF session, CSRF-protected mutations,
generated Hey API data clients, accessible states, and both light and
dark themes. Handwritten transport is reserved for documented protocol
flows such as navigation redirects and streaming.

Files:

  • apps/web/src/features/assistant/assistant-message-constraints.ts
  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/src/features/assistant/api/chat-transport.ts
  • apps/web/src/features/assistant/assistant-evidence.ts
  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • apps/web/src/features/assistant/components/assistant-page.tsx
apps/web/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

Preserve the existing browser test suite when changing the web application.

Files:

  • apps/web/src/features/assistant/assistant-draft-storage.test.ts
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/test/e2e/assistant-pipeline.spec.ts
apps/docs/content/docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (apps/docs/CLAUDE.md)

apps/docs/content/docs/**/*.{md,mdx}: Public prose must live only in apps/docs/content/docs; internal engineering documents are source evidence, not publication input.
sourceRefs is build-time traceability metadata and must never be rendered in published content.
Draft pages must remain excluded unless DOCS_INCLUDE_DRAFTS=true is set for a local or controlled preview.

Files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
apps/docs/content/docs/**/*.mdx

📄 CodeRabbit inference engine (apps/docs/CLAUDE.md)

Use index.mdx for a section root and <slug>.mdx for a named English page; add Vietnamese pages individually as adjacent index.vi.mdx or <slug>.vi.mdx files, using the /vi/docs/... route.

Files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
apps/api/src/main/java/**/*.java

⚙️ CodeRabbit configuration file

apps/api/src/main/java/**/*.java: Enforce the browser-BFF and resource-server boundaries. Authentication
must resolve an active internal actor through the explicit issuer and
subject binding. Reject identity, tenant, roles, or permissions supplied
by request payloads, JWT email, or untrusted JWT role claims.

Files:

  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantChatRequest.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantConfiguration.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
core/src/main/resources/db/migration/*.sql

⚙️ CodeRabbit configuration file

core/src/main/resources/db/migration/*.sql: The repository is pre-release: V1 is the intentionally resettable clean
baseline and development data carries no migration cost. Once a release
baseline is frozen, later Flyway migrations are immutable. Check tenant
isolation, foreign keys, uniqueness, indexes, append-only evidence
semantics, safe defaults, and PostgreSQL 18 plus pgvector compatibility.

Files:

  • core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql
🧠 Learnings (7)
📚 Learning: 2026-08-05T09:53:56.596Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 300
File: .tegami/2026-08-05-retrieval-recall-observations.md:7-7
Timestamp: 2026-08-05T09:53:56.596Z
Learning: For Tegami release fragments in `.tegami/*.md`, do not require a top-level H1 solely to satisfy markdownlint MD041. These fragments must instead contain an approved level-two public changelog section, such as `## Improvements`, as enforced by `scripts/check-release.mjs`; the generated release output contract prevents adding a second page-level H1.

Applied to files:

  • .tegami/2026-08-10-assistant-governed-file-evidence.md
📚 Learning: 2026-08-02T08:30:57.335Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 270
File: core/src/main/java/com/orgmemory/core/assetregistry/AssetDraftRepository.java:15-23
Timestamp: 2026-08-02T08:30:57.335Z
Learning: For OrgMemory JPA repository methods using `PESSIMISTIC_WRITE`, do not add a finite lock-timeout hint as part of a behavior-preserving refactor. The V1 PostgreSQL configuration uses `lock_timeout = 0`; any finite lock timeout must be established as a platform-wide database and transaction policy rather than configured on an individual method.

Applied to files:

  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBindingRepository.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBindingRepository.java
📚 Learning: 2026-07-28T20:06:14.930Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 112
File: apps/docs/content/docs/developers/api-reference/administration.mdx:11-11
Timestamp: 2026-07-28T20:06:14.930Z
Learning: In OrgMemory public documentation MDX files, ensure any `lastReviewed` dates are set using the repository project timezone `Asia/Bangkok`, not the reviewer’s local timezone or the runtime/build timezone. When generating or updating API-reference pages, intentionally use the exact same `lastReviewed` date convention as the authored public documentation pages to keep timestamps consistent across both sources.

Applied to files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
📚 Learning: 2026-07-28T20:06:15.064Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 112
File: apps/docs/content/docs/developers/api-reference/authentication.mdx:12-12
Timestamp: 2026-07-28T20:06:15.064Z
Learning: In OrgMemory docs/tests that describe date-based review checks, treat the project timezone as Asia/Bangkok for all “date” comparisons/validations. Do not assume UTC when interpreting or validating fields like `lastReviewed`. For example, `lastReviewed: '2026-07-29'` should be considered valid when the effective “current date” in Asia/Bangkok is July 29, 2026 (not merely when the UTC date matches).

Applied to files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
📚 Learning: 2026-07-30T06:46:08.031Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 144
File: apps/docs/public-content.manifest.json:13-67
Timestamp: 2026-07-30T06:46:08.031Z
Learning: For the Fumadocs docs portal under apps/docs, follow the expected MDX filename conventions that drive section-root vs named-page routing. Use `index.mdx` for English section-root pages and `<slug>.mdx` for named pages. For Vietnamese, use adjacent locale-suffixed files: `index.vi.mdx` for section roots and `<slug>.vi.mdx` for named pages. Do not require or enforce a `page.mdx` filename; doing so would change/break the intended section-root route structure.

Applied to files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
📚 Learning: 2026-07-26T05:46:47.443Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 61
File: apps/mcp/src/main/java/com/orgmemory/mcp/McpSecurityConfiguration.java:50-52
Timestamp: 2026-07-26T05:46:47.443Z
Learning: In OrgMemory, treat the `apps/mcp` and `apps/api` as independent protocol adapter modules. When adjusting OAuth/wire-level scopes, do not introduce a shared Java constant or create a code dependency from `apps/mcp` to `apps/api` solely to deduplicate scope values. Instead, keep OAuth/scope constants adapter-local (e.g., in the relevant adapter/security configuration classes) and ensure cross-adapter consistency via automated realm/OAuth/authorization tests, rather than via shared wiring-level constants or cross-module references.

Applied to files:

  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantChatRequest.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantConfiguration.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
📚 Learning: 2026-07-23T23:30:44.585Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 30
File: core/src/main/resources/db/migration/V32__evidence_scoped_graph_semantics.sql:0-0
Timestamp: 2026-07-23T23:30:44.585Z
Learning: For OrgMemory PostgreSQL Flyway migrations under core/src/main/resources/db/migration, do not recommend using `CREATE INDEX CONCURRENTLY` or `DROP INDEX CONCURRENTLY` inside application-owned Flyway migration SQL. Flyway’s schema-history connection may hold a transaction that can cause concurrent index operations to wait indefinitely (e.g., on a `virtualxid`), and docs/conventions.md forbids this pattern. If you need large production-table index replacement, pre-stage online index operations via the deployment pipeline (outside Flyway) rather than inside the migration; “ordinary” index replacement is acceptable for unreleased projections before production traffic.

Applied to files:

  • core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql
🪛 ast-grep (0.45.0)
core/src/main/java/com/orgmemory/core/assistant/AssistantService.java

[warning] 177-182: Avoid LDAP injections
Context: retrieval.search(
actor,
question,
requestedLimit,
requestId,
selection)
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.

(ldap-injection-java)


[warning] 183-187: Avoid LDAP injections
Context: retrieval.search(
actor,
question,
requestedLimit,
requestId)
Note: [CWE-90] Improper Neutralization of Special Elements used in an LDAP Query ('LDAP Injection'). Security best practice.

(ldap-injection-java)

🪛 markdownlint-cli2 (0.23.2)
.tegami/2026-08-10-assistant-governed-file-evidence.md

[warning] 7-7: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🪛 SQLFluff (4.2.2)
core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql

[error] 31-34: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)


[error] 84-87: CREATE INDEX should use CONCURRENTLY to avoid locking the table during the build.

(PG01)

🪛 Squawk (2.61.0)
core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql

[warning] 37-38: By default new constraints require a table scan and block writes to the table while that scan occurs. Use NOT VALID with a later VALIDATE CONSTRAINT call.

(constraint-missing-not-valid)


[warning] 37-38: Adding a UNIQUE constraint requires an ACCESS EXCLUSIVE lock which blocks reads and writes to the table while the index is built. Create an index CONCURRENTLY and create the constraint using the index.

(disallowed-unique-constraint)


[warning] 44-44: Changing the size of a varchar field requires an ACCESS EXCLUSIVE lock, that will prevent all reads and writes to the table. Use a TEXT field with a CHECK constraint.

(prefer-text-field)


[warning] 49-49: Using 32-bit integer fields can result in hitting the max int limit. Use 64-bit integer values instead to prevent hitting this limit.

(prefer-bigint-over-int)

🔇 Additional comments (59)
ARCHITECTURE.md (2)

166-170: LGTM!


338-344: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedEvidenceQuery.java (1)

1-13: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUploadCommand.java (1)

1-18: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUploadResult.java (1)

1-18: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/evidence/package-info.java (1)

1-5: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceLedgerGovernedEvidenceQuery.java (1)

1-68: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadRegistrationService.java (1)

39-39: LGTM!

Also applies to: 70-79

core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedEvidenceRef.java (1)

6-46: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/evidence/GovernedFileUpload.java (1)

5-11: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceLedgerGovernedFileUpload.java (1)

9-35: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadResult.java (1)

6-17: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadService.java (1)

42-101: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/sourceledger/package-info.java (1)

12-22: LGTM!

apps/api/src/main/java/com/orgmemory/api/assistant/AssistantChatRequest.java (1)

5-21: LGTM!

apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java (1)

110-169: LGTM!

Also applies to: 182-199

apps/web/src/features/assistant/api/chat-transport.ts (1)

8-13: LGTM!

Also applies to: 38-38

apps/web/src/features/assistant/assistant-evidence.ts (1)

1-33: LGTM!

apps/web/src/features/assistant/assistant-message-constraints.ts (1)

1-1: LGTM!

apps/web/src/features/assistant/components/assistant-page.tsx (2)

2-17: LGTM!

Also applies to: 49-49, 60-64, 79-111, 380-382, 398-398, 407-407, 437-439, 477-480, 492-492, 590-593, 722-723, 768-775, 817-853


989-1035: LGTM!

.tegami/2026-08-10-assistant-governed-file-evidence.md (1)

1-21: LGTM!

apps/api/src/test/java/com/orgmemory/api/OpenApiContractTests.java (1)

10-11: LGTM!

Also applies to: 55-73

apps/api/src/test/java/com/orgmemory/api/assistant/AssistantChatRequestValidationTests.java (1)

15-21: LGTM!

Also applies to: 32-34, 44-63, 83-91

apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java (1)

25-26: LGTM!

Also applies to: 97-98, 158-159, 205-206, 259-260, 333-334, 442-443, 463-464

core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceUploadServiceTests.java (1)

24-99: LGTM!

core/src/test/java/com/orgmemory/core/assistant/AssistantServiceTests.java (1)

11-19: LGTM!

Also applies to: 116-155

core/src/test/java/com/orgmemory/core/knowledge/retrieval/CanonicalHybridKnowledgeSearchTests.java (1)

21-21: LGTM!

Also applies to: 140-174, 427-435

core/src/test/java/com/orgmemory/core/knowledge/retrieval/GraphRagKnowledgeRetrievalServiceTests.java (1)

28-28: LGTM!

Also applies to: 96-132

core/src/test/java/com/orgmemory/core/knowledge/sourceledger/SourceUploadServiceTests.java (1)

60-60: LGTM!

apps/web/src/features/assistant/assistant-draft-storage.test.ts (1)

27-35: LGTM!

apps/web/src/features/assistant/assistant-evidence.test.ts (1)

1-30: LGTM!

core/src/test/java/com/orgmemory/core/ModulithVerificationTests.java (1)

173-173: LGTM!

Also applies to: 731-731, 890-890, 1086-1119, 1141-1142

core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java (1)

56-56: LGTM!

core/src/test/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerabilityQueryTests.java (1)

18-78: LGTM!

apps/web/test/e2e/assistant-pipeline.spec.ts (1)

1228-1244: 🎯 Functional Correctness

Retain the __streamMonitor declarations and reset call.

The declarations are in separate type assertions, and the block calls reset() once.

			> Likely an incorrect or invalid review comment.
core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceAnswerabilityPort.java (1)

1-30: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceStatus.java (1)

1-9: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceTurnClaim.java (1)

1-14: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBinding.java (1)

10-59: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBindingRepository.java (1)

1-8: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerability.java (1)

1-23: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/graph/GraphEvidenceAnswerabilityQuery.java (1)

30-67: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/graph/package-info.java (1)

16-16: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/search/PermissionAwareKnowledgeSearch.java (1)

13-32: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantService.java (1)

14-14: LGTM!

Also applies to: 147-195

apps/api/src/main/java/com/orgmemory/api/assistant/AssistantConfiguration.java (1)

7-18: LGTM!

Also applies to: 76-98

core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBinding.java (1)

10-66: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBindingRepository.java (1)

9-31: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceBindingView.java (1)

6-17: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceService.java (2)

124-184: LGTM!


57-122: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceUploadService.java (1)

27-45: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java (1)

28-42: LGTM!

Also applies to: 90-117

core/src/main/java/com/orgmemory/core/knowledge/search/KnowledgeEvidenceSelection.java (2)

17-43: LGTM!

Also applies to: 49-92


45-47: 🩺 Stability & Availability

No change needed.

Set.copyOf de-duplicated input elements, so assetIds() does not need a pre-existing uniqueness check on knowledgeAssetId.

core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java (1)

86-115: LGTM!

Also applies to: 171-179, 257-267, 299-313

core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java (1)

205-224: LGTM!

Also applies to: 239-246, 257-262, 286-287, 392-402, 473-490, 529-542, 1086-1097, 1107-1113

core/src/main/java/com/orgmemory/core/knowledge/retrieval/ResolvedKnowledgeEvidenceScope.java (1)

55-78: LGTM!

Comment thread apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java Outdated
Comment thread apps/docs/content/docs/reference/api-reference/assistant.mdx
Comment thread apps/web/src/features/assistant/components/assistant-page.tsx Outdated
Comment thread apps/web/src/features/assistant/components/assistant-page.tsx Outdated
Comment thread apps/web/src/features/assistant/components/assistant-page.tsx
Comment on lines +58 to +63
CONSTRAINT fk_assistant_turn_evidence_binding
FOREIGN KEY (binding_id, organization_id, conversation_id, actor_user_id)
REFERENCES public.assistant_evidence_bindings(
id, organization_id, conversation_id, created_by_user_id
)
ON DELETE CASCADE,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Prevent binding deletion from deleting turn evidence.

ON DELETE CASCADE deletes the turn-level evidence selection when assistant_evidence_bindings is deleted. This table must retain the evidence ceiling for retries and citations. Use ON DELETE NO ACTION and retain referenced bindings, or persist the source revision identity directly in assistant_turn_evidence_bindings.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql`
around lines 58 - 63, Update the fk_assistant_turn_evidence_binding foreign key
in the migration so deleting an assistant_evidence_bindings row cannot delete
its assistant turn evidence selection. Replace the ON DELETE CASCADE behavior
with ON DELETE NO ACTION and preserve the existing composite reference columns.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java`:
- Around line 136-142: Restrict retrieval using the complete
KnowledgeEvidenceSelection identity—asset ID plus source-object/source-revision
pairs—before ranking, LIMIT, and GraphRAG traversal by extending the
retrieval-scope and GraphRAG query contracts and applying exact predicates.
Update
core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java:136-142
and
core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java:401-401,1110-1115;
retain the late selection.contains checks unchanged as defense in depth at
DefaultCanonicalHybridKnowledgeSearch.java:312-318 and
DefaultGraphRagKnowledgeRetrievalService.java:535-545. Add coverage proving
another revision of the same asset cannot enter the candidate set or GraphRAG
query.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: cf6a8263-03c5-4641-b611-7a0b7fffda65

📥 Commits

Reviewing files that changed from the base of the PR and between fb44055 and de39650.

⛔ Files ignored due to path filters (2)
  • docs/specs/domains/assistant-and-mcp.md is excluded by !docs/**
  • docs/tests/domains/assistant-and-mcp.md is excluded by !docs/**
📒 Files selected for processing (20)
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java
  • apps/docs/content/docs/reference/api-reference/assistant.mdx
  • apps/docs/scripts/generate-openapi.ts
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/src/features/assistant/assistant-evidence.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceService.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBinding.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/KnowledgeSearchAuthorizationService.java
  • core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql
  • core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceServiceTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/CanonicalHybridKnowledgeSearchTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/GraphRagKnowledgeRetrievalServiceTests.java
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: Public docs · Node 24
  • GitHub Check: PostgreSQL GraphRAG
  • GitHub Check: Backend · Java 25
  • GitHub Check: Web · Node 24
🧰 Additional context used
📓 Path-based instructions (12)
apps/docs/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/docs/CLAUDE.md)

Verify unfamiliar Next.js and Fumadocs APIs against current official documentation or installed dependency types before using them.

Files:

  • apps/docs/scripts/generate-openapi.ts
**/*

📄 CodeRabbit inference engine (AGENTS.md)

**/*: Treat the repository and runtime evidence as the engineering system of record; do not treat chat or Northstar as authoritative.
Before changing a domain, read its specification, test-coverage document, and applicable decision filenames.
Material decisions about domain boundaries, authorization, persistence, publication, concurrency, cache isolation, parity scope, or deployment require an independent architecture challenge and documented alternatives before implementation.
Do not use completed increment documents as the source for current behavior; use them only for history or archaeology.
Before using unfamiliar Spring Boot, Spring Modulith, Spring AI, Gradle, React, Vite, Tailwind, TypeScript, Next.js, or Fumadocs APIs, consult current official documentation, Context7, and the relevant verification skill.
Read docs/guidelines/agent-safety.md before retrieval, AI, MCP, permission, upload, graph, or export work; never commit secrets or customer data.
Keep ddl-auto=validate and pair every persisted-model change with a Flyway migration.
Use the testing harness; a terminating clean test is the JVM context gate, and bootRun is not verification.

Files:

  • apps/docs/scripts/generate-openapi.ts
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/KnowledgeSearchAuthorizationService.java
  • core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql
  • core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBinding.java
  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/CanonicalHybridKnowledgeSearchTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceService.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceServiceTests.java
  • apps/web/src/features/assistant/assistant-evidence.ts
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/GraphRagKnowledgeRetrievalServiceTests.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java
  • apps/docs/content/docs/reference/api-reference/assistant.mdx
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
  • apps/web/src/features/assistant/components/assistant-page.tsx
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Frontend changes must pass lint, typecheck, tests, and a production build; perform browser verification when the flow warrants it.

Files:

  • apps/docs/scripts/generate-openapi.ts
  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/src/features/assistant/assistant-evidence.ts
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

Apply IDE inspection only to edited backend Java files.

Files:

  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/KnowledgeSearchAuthorizationService.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBinding.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/CanonicalHybridKnowledgeSearchTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceService.java
  • core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceServiceTests.java
  • core/src/test/java/com/orgmemory/core/knowledge/retrieval/GraphRagKnowledgeRetrievalServiceTests.java
  • apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java
  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
  • core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java
core/src/main/java/com/orgmemory/core/{authorization,knowledge,permission}/**/*.java

⚙️ CodeRabbit configuration file

core/src/main/java/com/orgmemory/core/{authorization,knowledge,permission}/**/*.java: Treat PostgreSQL ACL evidence as canonical and OpenFGA as the relationship
authorization decision point. Authorization must fail closed. Filtering
must happen before ranking, LIMIT, graph traversal, answer generation,
export, and citation rendering. Flag metadata or timing leak paths.

Files:

  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/KnowledgeSearchAuthorizationService.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java
  • core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java
core/src/main/resources/db/migration/*.sql

⚙️ CodeRabbit configuration file

core/src/main/resources/db/migration/*.sql: The repository is pre-release: V1 is the intentionally resettable clean
baseline and development data carries no migration cost. Once a release
baseline is frozen, later Flyway migrations are immutable. Check tenant
isolation, foreign keys, uniqueness, indexes, append-only evidence
semantics, safe defaults, and PostgreSQL 18 plus pgvector compatibility.

Files:

  • core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.{ts,tsx}: Extend the established OrgMemory product shell, design tokens, shadcn/Radix primitives, and existing layout patterns; do not introduce a separate visual system in the web application.
Generate ordinary REST clients from contracts/openapi.json using Hey API.
Use TanStack Query for server state, TanStack Router for navigation, and limit Zustand to durable or high-frequency UI state.
Preserve keyboard accessibility, light/dark theme support, loading and error states, and responsive behavior in the web application.

Files:

  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/src/features/assistant/assistant-evidence.ts
  • apps/web/test/e2e/assistant-pipeline.spec.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
apps/web/src/**/*.{ts,tsx}

⚙️ CodeRabbit configuration file

apps/web/src/**/*.{ts,tsx}: OAuth access and refresh tokens must never enter browser JavaScript or
browser storage. Use the HttpOnly BFF session, CSRF-protected mutations,
generated Hey API data clients, accessible states, and both light and
dark themes. Handwritten transport is reserved for documented protocol
flows such as navigation redirects and streaming.

Files:

  • apps/web/src/features/sources/components/source-upload-dialog.tsx
  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/src/features/assistant/assistant-evidence.ts
  • apps/web/src/features/assistant/components/assistant-page.tsx
apps/web/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

Preserve the existing browser test suite when changing the web application.

Files:

  • apps/web/src/features/assistant/assistant-evidence.test.ts
  • apps/web/test/e2e/assistant-pipeline.spec.ts
apps/docs/content/docs/**/*.{md,mdx}

📄 CodeRabbit inference engine (apps/docs/CLAUDE.md)

apps/docs/content/docs/**/*.{md,mdx}: Public prose must live only in apps/docs/content/docs; internal engineering documents are source evidence, not publication input.
sourceRefs is build-time traceability metadata and must never be rendered in published content.
Draft pages must remain excluded unless DOCS_INCLUDE_DRAFTS=true is set for a local or controlled preview.

Files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
apps/docs/content/docs/**/*.mdx

📄 CodeRabbit inference engine (apps/docs/CLAUDE.md)

Use index.mdx for a section root and <slug>.mdx for a named English page; add Vietnamese pages individually as adjacent index.vi.mdx or <slug>.vi.mdx files, using the /vi/docs/... route.

Files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
apps/api/src/main/java/**/*.java

⚙️ CodeRabbit configuration file

apps/api/src/main/java/**/*.java: Enforce the browser-BFF and resource-server boundaries. Authentication
must resolve an active internal actor through the explicit issuer and
subject binding. Reject identity, tenant, roles, or permissions supplied
by request payloads, JWT email, or untrusted JWT role claims.

Files:

  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
🧠 Learnings (6)
📚 Learning: 2026-07-28T20:06:14.375Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 112
File: apps/docs/scripts/generate-openapi.ts:211-219
Timestamp: 2026-07-28T20:06:14.375Z
Learning: When generating OrgMemory documentation and authored documentation metadata (e.g., `lastReviewed`), evaluate and format any generated/derived dates using the project timezone `Asia/Bangkok`. Ensure the generated dates stay consistent with the authored corpus when interpreted in that timezone (i.e., avoid UTC/local-time defaults or timezone drift during OpenAPI/docs generation).

Applied to files:

  • apps/docs/scripts/generate-openapi.ts
📚 Learning: 2026-07-23T23:30:44.585Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 30
File: core/src/main/resources/db/migration/V32__evidence_scoped_graph_semantics.sql:0-0
Timestamp: 2026-07-23T23:30:44.585Z
Learning: For OrgMemory PostgreSQL Flyway migrations under core/src/main/resources/db/migration, do not recommend using `CREATE INDEX CONCURRENTLY` or `DROP INDEX CONCURRENTLY` inside application-owned Flyway migration SQL. Flyway’s schema-history connection may hold a transaction that can cause concurrent index operations to wait indefinitely (e.g., on a `virtualxid`), and docs/conventions.md forbids this pattern. If you need large production-table index replacement, pre-stage online index operations via the deployment pipeline (outside Flyway) rather than inside the migration; “ordinary” index replacement is acceptable for unreleased projections before production traffic.

Applied to files:

  • core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql
📚 Learning: 2026-07-28T20:06:14.930Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 112
File: apps/docs/content/docs/developers/api-reference/administration.mdx:11-11
Timestamp: 2026-07-28T20:06:14.930Z
Learning: In OrgMemory public documentation MDX files, ensure any `lastReviewed` dates are set using the repository project timezone `Asia/Bangkok`, not the reviewer’s local timezone or the runtime/build timezone. When generating or updating API-reference pages, intentionally use the exact same `lastReviewed` date convention as the authored public documentation pages to keep timestamps consistent across both sources.

Applied to files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
📚 Learning: 2026-07-28T20:06:15.064Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 112
File: apps/docs/content/docs/developers/api-reference/authentication.mdx:12-12
Timestamp: 2026-07-28T20:06:15.064Z
Learning: In OrgMemory docs/tests that describe date-based review checks, treat the project timezone as Asia/Bangkok for all “date” comparisons/validations. Do not assume UTC when interpreting or validating fields like `lastReviewed`. For example, `lastReviewed: '2026-07-29'` should be considered valid when the effective “current date” in Asia/Bangkok is July 29, 2026 (not merely when the UTC date matches).

Applied to files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
📚 Learning: 2026-07-30T06:46:08.031Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 144
File: apps/docs/public-content.manifest.json:13-67
Timestamp: 2026-07-30T06:46:08.031Z
Learning: For the Fumadocs docs portal under apps/docs, follow the expected MDX filename conventions that drive section-root vs named-page routing. Use `index.mdx` for English section-root pages and `<slug>.mdx` for named pages. For Vietnamese, use adjacent locale-suffixed files: `index.vi.mdx` for section roots and `<slug>.vi.mdx` for named pages. Do not require or enforce a `page.mdx` filename; doing so would change/break the intended section-root route structure.

Applied to files:

  • apps/docs/content/docs/reference/api-reference/assistant.mdx
📚 Learning: 2026-07-26T05:46:47.443Z
Learnt from: kl3inIT
Repo: kl3inIT/OrgMemory PR: 61
File: apps/mcp/src/main/java/com/orgmemory/mcp/McpSecurityConfiguration.java:50-52
Timestamp: 2026-07-26T05:46:47.443Z
Learning: In OrgMemory, treat the `apps/mcp` and `apps/api` as independent protocol adapter modules. When adjusting OAuth/wire-level scopes, do not introduce a shared Java constant or create a code dependency from `apps/mcp` to `apps/api` solely to deduplicate scope values. Instead, keep OAuth/scope constants adapter-local (e.g., in the relevant adapter/security configuration classes) and ensure cross-adapter consistency via automated realm/OAuth/authorization tests, rather than via shared wiring-level constants or cross-module references.

Applied to files:

  • apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java
🪛 ast-grep (0.45.0)
apps/web/test/e2e/assistant-pipeline.spec.ts

[warning] 151-153: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(
^/api/assistant/conversations/${CONVERSATION_ID}/evidence/([^/]+)$,
)
Note: [CWE-1333] Inefficient Regular Expression Complexity

(regexp-from-variable)

🪛 OpenGrep (1.26.0)
apps/web/test/e2e/assistant-pipeline.spec.ts

[ERROR] 152-154: Dynamic command passed to child_process.exec/execSync. Use child_process.execFile or spawn with an argument array instead.

(coderabbit.command-injection.exec-js)

🔇 Additional comments (18)
apps/api/src/main/java/com/orgmemory/api/assistant/AssistantController.java (1)

88-113: 📐 Maintainability & Code Quality

Verify the configured Java IDE inspection.

The supplied context has no inspection result for this edited backend Java file. Run the configured IDE inspection before merge.

As per coding guidelines: "**/*.java: Apply IDE inspection only to edited backend Java files."

Also applies to: 115-169, 182-219

Source: Coding guidelines

apps/web/src/features/assistant/components/assistant-page.tsx (1)

655-685: 📐 Maintainability & Code Quality

Verify the required frontend quality gates.

The supplied context has no repository or CI evidence for lint, typecheck, tests, production build, or browser verification.

  • apps/web/src/features/assistant/components/assistant-page.tsx#L655-L685: Verify evidence polling, retrying status, and submit blocking in a browser.
  • apps/web/src/features/sources/components/source-upload-dialog.tsx#L30-L235: Verify controlled dialog opening, upload errors, and retry behavior in a browser.
  • apps/web/src/features/assistant/assistant-evidence.ts#L9-L32: Run lint, typecheck, and unit tests for the helper contracts.
  • apps/web/src/features/assistant/assistant-evidence.test.ts#L33-L48: Run the extended test suite and retain these tests.

As per coding guidelines: "Frontend changes must pass lint, typecheck, tests, and a production build; perform browser verification when the flow warrants it."

Source: Coding guidelines

apps/docs/scripts/generate-openapi.ts (1)

218-218: LGTM!

apps/api/src/test/java/com/orgmemory/api/assistant/AssistantControllerStreamingTests.java (1)

25-30: LGTM!

Also applies to: 98-99, 159-160, 206-207, 246-247, 261-262, 315-316, 336-337, 445-446, 466-467

apps/docs/content/docs/reference/api-reference/assistant.mdx (1)

10-10: LGTM!

Also applies to: 49-51, 85-90, 117-118, 141-144, 157-157

core/src/test/java/com/orgmemory/core/assistant/AssistantConversationServiceTests.java (1)

12-18: LGTM!

Also applies to: 43-44, 60-60, 160-216

core/src/test/java/com/orgmemory/core/assistant/AssistantEvidenceServiceTests.java (1)

1-75: LGTM!

Also applies to: 77-175, 177-242, 244-272, 274-299, 301-349, 351-411

apps/web/test/e2e/assistant-pipeline.spec.ts (2)

10-10: LGTM!

Also applies to: 36-36, 49-50, 130-180, 229-229, 395-418, 421-440, 462-462


893-897: 📐 Maintainability & Code Quality

Run the web validation gates before approval. Run pnpm --filter @orgmemory/web check:web and the relevant test:e2e flow for assistant-pipeline.spec.ts.

core/src/main/resources/db/migration/V32__assistant_governed_file_evidence.sql (1)

22-22: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantEvidenceService.java (1)

195-208: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantTurnEvidenceBinding.java (1)

59-74: LGTM!

core/src/main/java/com/orgmemory/core/assistant/AssistantConversationService.java (1)

28-43: LGTM!

Also applies to: 58-118, 375-378

core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultCanonicalHybridKnowledgeSearch.java (1)

86-115: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/retrieval/DefaultGraphRagKnowledgeRetrievalService.java (1)

193-246: LGTM!

core/src/main/java/com/orgmemory/core/knowledge/retrieval/KnowledgeSearchAuthorizationService.java (1)

21-22: LGTM!

core/src/test/java/com/orgmemory/core/knowledge/retrieval/CanonicalHybridKnowledgeSearchTests.java (1)

132-152: LGTM!

Also applies to: 162-196, 449-457

core/src/test/java/com/orgmemory/core/knowledge/retrieval/GraphRagKnowledgeRetrievalServiceTests.java (1)

134-165: LGTM!

@kl3inIT
kl3inIT merged commit 2df3fcf into main Aug 11, 2026
19 checks passed
@kl3inIT
kl3inIT deleted the feat/assistant-file-evidence branch August 11, 2026 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant