One Question, Three Sources: How Far Code, Jira, and Confluence Can Each Answer It
The hard part of cross-source retrieval is not finding more text; it is judging what the requirement, the design, and the current code can each prove.
On this page · 10 sections
"Why doesn't the order query return this field?"
Jira may say the requirement is done. Confluence may describe the design. The repository may contain a resolver with the same name. And the production result can still be empty. All four can be true at once, because they answer four different questions: what the team wanted to build, how it was designed at the time, what a particular commit implemented, and what a particular environment actually ran.
The first problem enterprise RAG has to solve is not recall. It is the boundary of source authority. If all that survives indexing is an anonymous piece of text, then the better the system gets at summarizing, the more easily it fuses material with different timestamps and different evidentiary power into one wrong story.
The Short Version
- Jira, Confluence, code, and the production result answer four different questions, so all of them can be true at once.
- The first problem enterprise RAG has to solve is the boundary of source authority, not recall.
- Material that has only a title and a URL (
metadata_only) is a locating lead; it cannot be used to summarize a body. - Which source wins depends on the question: Jira and the design for requirements, the current commit for implementation, and none of these static sources for production state.
Knowledge Map for This Article
This chapter covers five core topics:
- source authority;
- stable identity;
- the difference between metadata-only and body-loaded;
- temporal semantics;
- least-privilege collection.
The Connected Sources Are Not Four Piles of Equivalent Text
The current local data scope of mt_rag has explicit boundaries. In the table, focus on the last two columns: what each source is best at proving, and what it cannot prove on its own.
| Source | Current collection scope | Best at proving | Cannot prove on its own |
|---|---|---|---|
| Jira | Issues within a controlled project scope: descriptions, comments, changelog, worklogs, remote links, attachment metadata, and readable attachments | Requirements, accepted scope, status changes, and discussion | Current code, deployed version, production behavior |
| Confluence | Controlled entry pages and their descendants, multiple body formats, and attachments | Design background, business rules, terminology, and historical decisions | The current call chain, or that a given branch has implemented something |
| Git/Bitbucket | The repository inventory discovered recursively on the local machine; each repository is updated to main/master, its commit is pinned, and then the code is parsed |
The static implementation, symbols, and call evidence in the pinned commit | Full coverage of the Bitbucket workspace, production deployment, runtime dynamic dispatch |
| Business Config | Only a separately confirmed, non-user-state, read-only configuration scope | The configuration structure read under one specific authorization | User state, transaction and payment data, live production behavior |
High-cost or currently unsupported attachments keep their metadata only: they are not downloaded, not retried, and no text is extracted.
Business Config explicitly excludes any user-state, transaction-state, payment-state, or personally identifiable data. It is still a read of persistent data, so it must go through a separate risk statement and explicit confirmation; it cannot run automatically just because "RAG needs more data."
PRs have their own source type in the target contract, but there is currently no dedicated PR collector. The PullRequest nodes in the graph come mainly from URLs in Jira/Confluence text. They are link-derived entities; they do not contain the full diff, comments, approvals, or revisions.
The direct evidence that exists today is pinned code, Jira/Confluence raw data, and the remote links already collected. A contract permitting a source does not mean the current corpus covers it completely.
SourceRecord: The Target Contract Is Still Some Distance from What Collection Produces
SourceRecordV1 defines the strict contract I want every source to honor eventually. It does more than store a body: it splits one source record into several domains that cannot stand in for one another:
record_id / source_type / native_id
record_payload_hash
content_status
original_blob + original_content_hash
created_at / updated_at / observed_at
source_url / attachment_urls
freshness / metadata / provenance
The most important part is the fail-closed semantics of content_status, that is, refusing when in doubt:
availablemust have both an original blob and an original content hash;metadata_onlyandunavailableare not allowed to pretend they have a body;- when downstream sees a page title and a URL, it can only say "this page was found"; it cannot summarize the page's content.
But the target contract must not be written up as a finished migration. Today's production collectors still mostly emit legacy raw JSON and SourceManifestEntryV1; direct construction of SourceRecordV1 appears mainly in the legacy adapter and in tests.
The query side already enforces a fail-closed constraint in the same direction: a Confluence result can enter the business summary only when document_read_status=body_loaded; metadata_only or body_missing can serve only as a locating lead. The real state is "the downstream contract has been tightened; the upstream format is still migrating."
Stable Identity Cannot Be Built from Titles
Pages get renamed, issue statuses change, and code line numbers move. A stable ID has to be built from the source's native identity, not from display text:
| Object | Stable identity |
|---|---|
| Confluence Page | con_<content_id> |
| Jira Issue | jira_<ISSUE_KEY> |
| Repository | Workspace + Repo Slug |
| Attachment | Parent Source Record + Native Attachment ID |
| Code Symbol (target helper) | Repo, Language, Relative Path, Kind, Qualified Name |
The target code_symbol_id() does not include the commit or the line range. The reason is that it expresses "logically the same symbol"; the commit, line, and content hash belong to the revision/locator of this particular version of the evidence. Conversely, if the commit were packed into the entity ID, every code update would manufacture a brand-new entity, and the graph could no longer express version changes of the same symbol.
There is also an implementation gap here that has not yet converged: the actual CPG _node_id() currently encodes the line into its hash, so a symbol that merely moves to a different line gets a different node ID. The existing stable-ID tests cover the helper; they do not prove that real CPG node identity is stable across line moves. I am keeping this discrepancy in the article because it is exactly what the canonical migration still has to resolve.
For the Same Field Question, What Is the Right Reading Order?
Suppose I need to determine whether a GraphQL field is wired end to end:
- Use Jira to confirm that the field is within the accepted scope, not merely mentioned in a comment;
- Use Confluence to understand the field's business semantics and the approach chosen at the time, while recording the page version and update time;
- Locate the operation, selected field, resolver, and provider in the pinned commit of the target repository;
- Only when evidence-carrying graph edges such as
USES_OPERATION -> SELECTS_FIELD -> RESOLVES_FIELDexist do I describe the relationship as a verified call chain; - If the question is "is it live in production?", a separate deployment/runtime readback is still required. The current static corpus has to stop here.
This is not a fixed rule that "Jira ranks below code." Priority depends on the question: for a question about requirements, Jira and the design lead; for a question about implementation, the current commit leads; for a question about production state, none of these static sources is enough.
Why a Code Source Has to Be Pinned First
The core of code collection is not "scanning a directory"; it is establishing a revision that can be read repeatably.
The current source gate works in three steps:
- It discovers code repositories recursively and excludes historical workspace copies through an explicit denylist;
- Before updating, it runs a tracked-change preflight across all repositories; if it finds a conflict, it blocks globally and does not reset, clean, or stash the user's changes;
- Repository by repository, it runs
fetch --prune, resolvesorigin/HEADor the only availablemain/master, runspull --ff-only, verifiesHEAD == origin/<branch>, and records the commit pin.
The parsing stage verifies the pin again, then reads bytes from the verified working-tree path and writes the commit into the locator; it does not run git show <commit>:<path> file by file. So under normal conditions the working tree is aligned with the pin, but a small TOCTOU window remains between verification and the actual read, that is, the state can change after the check and before the read.
When the network fails, an explicit degraded mode allows pinning only a branch that is clean and exactly equal to the cached remote ref, marks it stale_remote_unreachable, and does not claim to be fresh.
Failure Modes and Trade-offs
Each row below is one failure: the middle column is the protection, and the last column is what that protection costs.
| Failure mode | Protection | Trade-off |
|---|---|---|
| A page has only a title, no body | metadata_only; body summaries are forbidden |
Give one fewer answer rather than guess business rules from a title |
| A Jira status is Done | It proves only the ticket status; it cannot be mapped to a successful deployment | Additional CI/deployment/runtime evidence is needed |
| A repository is dirty or cannot fast-forward | Code extraction for this run fails closed | Freshness yields to not overwriting developers' work and to repeatability |
| The remote is unreachable | A usable cached pin can only be marked stale | It can locate an old entry point but cannot claim to be current |
| An object is not seen in an incremental collection | "Absence" is not treated as deletion | A real deletion has to wait for an authoritative full inventory/reconciliation |
| The DDB scope is unclear | Not executed by default; only the fixed read-only Business Config scope is allowed | Collect less data in exchange for privacy, cost, and production safety |
| Scheduled Jira handoff | The current scheduled command runs a full collect first, then enriches only placeholders; there may be no Jira issue source event | Raw being updated does not mean the V3 journal loop is closed; event acceptance has to be added |
| The legacy full-refresh entry point reads DDB | The compatibility path does not automatically inherit the weekly gate | External safety confirmation is still required; --read-only cannot be treated as zero risk |
Verifiable Project Evidence
- Source policy configuration: controlled document entry points, issue scope, the code source gate, and the Business Config include/exclude scope;
src/mt_rag/core/system_contracts.py:SourceRecordV1,EvidenceRefV1, and thecontent_statusinvariants;src/mt_rag/operations/cli.py: the Jira/Confluence collectors, attachments, raw writes, and the current source event handoff;src/mt_rag/code/repositories.py: repo discovery, inventory comparison, dirty preflight, branch resolution, and pinning;src/mt_rag/documents/jira.py: turning descriptions, comments, changelog, worklogs, and remote links into locatable blocks;src/mt_rag/documents/batch.py: Confluence raw to DocumentIR and CAS;- The "current data scope" and "re-entrancy policy" sections of
README.md: the actual corpus, attachments, and DDB boundary.
References
- Atlassian Jira Cloud REST API documentation;
- Atlassian Confluence Cloud REST API documentation;
- Bitbucket Cloud Repositories API documentation;
- Git Internals: Git Objects;
- AWS DynamoDB documentation on read consistency.
The first principle of cross-source RAG is not "the more sources connected, the better." It is that every piece of material, once inside the system, still knows what it is, which version it came from, and how far it can prove anything at most.
Related notes
Local RAG Design: Store the Evidence First, Then Retrieve
How mt_rag separates replayable evidence, rebuildable query views, verified graph paths, and bounded generation—and why current source still wins.
Why a Code Hit Is Not Yet an Answer
Engineering retrieval has to bind results to a repository, a commit, and a symbol; a hit that is missing, stale, or from the wrong repository is only a locating lead.
Working on something similar?
I'm always happy to compare notes on distributed systems, delivery, and applied AI.
[email protected]