Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 6 min read

Jira in the age of AI, part 4: the right context at the right time

By this point in the series, the coding agent has a business problem, engineering standards, and a requirement to produce evidence. It still has to find the parts of the codebase that matter. β€œImplement ABC-123” can in

By this point in the series, the coding agent has a business problem, engineering standards, and a requirement to produce evidence.

It still has to find the parts of the codebase that matter.

β€œImplement ABC-123” can involve considerable archaeology. The business vocabulary in the ticket may bear little resemblance to the class names. A relevant rule may live several layers away from the screen being changed. An existing test may already document the edge case the agent is about to rediscover.

The next piece to add is a dedicated retrieval service the coding agent can consult while it works.

Give it a useful question. Get back relevant, inspectable source.

Give retrieval its own service

Build it as a separate service, running in a VM or container and exposed through MCP.

It should maintain a local Git clone and a PostgreSQL search index. The coding agent sends a question, identifies the repository and revision, and receives relevant code with enough provenance to inspect it.

The index contains code units such as functions, methods, and classes, along with tests and relevant documentation. Each indexed unit retains its repository, revision, path, symbol, and source location.

Chunking should respect those boundaries where practical. A function’s signature, enclosing class, and relevant comments often explain what a block of code means. Arbitrarily cutting it halfway through a method can discard exactly the context we need.

The service’s job is to find useful material and return it accurately. The coding agent uses that material to reason about the task.

That is the RAG workflow: retrieval supplies context for the agent’s subsequent analysis and generation.

Code needs several kinds of search

Semantic search is useful when the question and the implementation use different vocabulary.

A ticket might describe preventing duplicate submissions. The relevant implementation might talk about idempotency, request fingerprints, or uniqueness constraints.

But sometimes the agent already has an exact class name, an error message, or a symbol from a stack trace. Those are valuable clues too.

Combine several retrieval channels:

Search channel Implementation What it helps find
Semantic Embeddings stored and searched with pgvector Code related to a behavior or business concept
Full-text PostgreSQL text search, typically with a GIN index Matching terms in code, comments, and documentation
Symbol and path Indexed fields extracted from the codebase Named classes, methods, identifiers, and files
Partial or fuzzy text Trigram search where useful Incomplete identifiers and naming variations

Symbol extraction requires parsing or other indexing work. Installing pgvector does not make PostgreSQL understand the application’s class hierarchy.

Each channel produces candidates. The next question is how to combine them.

This is where RRF matters

A vector similarity score and a PostgreSQL full-text rank are on different scales. Adding the raw numbers together gives you a result whose meaning depends heavily on those scales.

Reciprocal Rank Fusion combines the positions in independently ranked result lists.

For each candidate, it adds a contribution from every list containing that candidate:

RRF(candidate) = sum of 1 / (k + rank)

Here, rank starts at one. A candidate absent from a list receives no contribution from that list. The constant k controls how strongly the very highest positions dominate; 60 is a common starting value, including in pgvector’s RRF example.

Give each code unit a consistent identity so a method found by semantic search and full-text search is recognized as the same candidate.

This lets the service combine several kinds of evidence about relevance without pretending their original scores are interchangeable.

Repository and revision remain explicit constraints. They should be applied consistently across the searches before results are fused.

RRF gives us an ordering of candidates to inspect. It cannot recover code that none of the searches found, and its score is not a probability that the candidate contains the bug.

For a supplied symbol or stack frame, preserve the direct match in the response. A useful literal clue should remain visible alongside the broader search results.

Let the index locate the code, then read the source

After retrieval and ranking, the service should fetch the actual source from its local Git repository at the requested revision.

The response should include:

  • Repository and commit.
  • File path and symbol.
  • Source location and exact excerpt.
  • Which retrieval channels found it.
  • A way to fetch the surrounding implementation.

Git can address a file at a particular revision using <commit>:<path>. That gives the service a precise source to read, independently of whichever branch happens to be checked out.

A generated explanation can accompany the excerpt, but it should remain identifiable as interpretation.

The source establishes what exists at that revision. The ticket establishes what the behavior should be. Tests help determine whether the implementation satisfies it.

There are two practical details to handle.

First, an accurate source read does not repair an outdated search index. The index needs to track changes, renames, and deletions for the revisions it claims to cover.

Second, the coding agent may have uncommitted changes. Those require an explicit working-tree snapshot or local inspection. A shared service answering about a committed revision cannot silently stand in for the agent’s current files.

β€œGround truth” needs an address.

Give Jira a useful first question

This brings us back to the ticket.

Alongside the business problem and acceptance criteria, include hints about the kinds of context the agent should retrieve.

For an illustrative debugging ticket:

Business problem

Some approved records are missing from exports. Every approved record the user is authorized to access must appear exactly once.

Context to investigate

Find the export flow, approval-to-eligibility mapping, authorization rules, query filters, and pagination behavior.

Retrieve tests covering mixed approval states, access restrictions, and page boundaries.

Use the attached failing run and build identifier as the starting evidence.

That gives the agent several productive questions without declaring the cause in advance.

A ticket that prematurely says β€œfix the pagination bug” can send the investigation down one path before anyone has established that pagination is responsible.

Paths and symbols are useful when known. Treat them as starting points, and let the agent investigate beyond them.

For a new feature, the hints might point toward similar implementations, supported extension points, existing validation rules, and the tests that protect adjacent behavior.

The analyst supplies business context. The developer adds architectural clues. The agent uses both to decide what to ask the helper.

The ticket should provide a useful starting direction and enough freedom to follow the evidence.

Retrieve again as the investigation develops

The first search is the beginning of the investigation.

For the export example, semantic retrieval might identify the eligibility policy and export service. Reading those implementations could expose a status mapper or query builder that deserves an exact symbol lookup.

The agent can then retrieve callers, related tests, and the applicable architectural guidance. As it learns more, it narrows or changes the question.

The retrieval service needs a way to expand a promising result into its surrounding source. Actual caller or dependency lookup requires the corresponding analysis tools or relationship index; embeddings alone do not supply that structure.

The same service can also make the previous post’s work available on demand: approved house-style guidance, accepted design decisions, and representative implementations.

Keep those sources identifiable. An architectural rule, a historical example, and the current implementation answer different questions.

Then close the investigation with execution. In the export example, a test fixture containing approved, unapproved, permitted, and restricted records can check the exported identifiers against the expected set. Retrieval helps locate and understand the implementation. The test checks the behavior.

Measure whether the helper earns its place

I’d evaluate the service against real historical tasks, using the repository state available when those tasks began.

Does the relevant code appear in a small result set? Does the agent reach a verified fix sooner? How much time and context does retrieval consume? Does it improve on ordinary repository search for the tasks where we expect it to help?

Those answers determine whether the extra service is useful.

The aim is to give the agent a dependable way to obtain the next piece of evidence it needs.

Across this series, that completes the loop: define a business outcome, make the engineering standards explicit, give the agent access to relevant context, and require evidence when it hands the work back.

A good Jira ticket gives the agent a problem to solveβ€”and a useful first question to ask the codebase.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.