# US 2026/0064408 A1 · Context-aware code generation and modification

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2026/0064408 A1
- Document ID: US20260064408A1
- Status: Published application
- Kind: A1
- Application number: 19/309,883
- Filed: 2025-08-26
- Published: 2026-03-05
- Earliest claimed: 2024-09-03
- Assignees: For Good AI Inc.
- Applicants: For Good AI Inc.
- Inventors: Andrey Filev; Dmitrii Krasnov
- Web page: https://patentgrep.com/patent/US20260064408A1

## CPC

- G06F 8/36: Software reuse
- G06F 8/30: Creation or generation of source code
- G06F 8/311: {Functional or applicative languages; Rewrite languages}
- G06F 8/33: Intelligent editors
- G06F 8/34: Graphical or visual programming
- G06F 8/35: model driven
- G06F 8/427: {Parsing}
- G06F 8/72: Code refactoring
- G06F 8/75: Structural analysis for program understanding
- G06F 8/77: Software metrics
- G06F 11/362: Debugging of software
- G06F 11/3684: {for test design, e.g. generating new test cases}
- G06F 11/3688: {for test execution, e.g. scheduling of test suites}
- G06F 11/3692: {for test results analysis}
- G06F 11/3698: Environments for analysis, debugging or testing of software
- G06F 16/137: {Hash-based (content-based indexing of textual data G06F16/31)}
- G06F 16/2237: {Vectors, bitmaps or matrices}
- G06F 16/24575: {using context}
- G06F 16/3347: {using vector based model}
- G06F 40/30: Semantic analysis
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

A system and method for generating computer code are provided. The system receives data indicating a trigger event to initiate code generation and selects a code generation agent based on attributes of the trigger event. The selected agent requests indexed context information from a context indexing component. The context indexing component generates indexed context information including project data associated with a user account, such as existing code, text data, file structure data, open file information, and project documentation. First embeddings are generated from the processed project data and stored in a vector database configured to be queried by the code generation agent. The system can further generate environmental data, hierarchical file structure summarizations, and indexed external data, creating additional embeddings stored in the vector database to provide comprehensive context for code generation.

## Claims

### Claim 1

A system comprising:
one or more processors; and
non-transitory computer-readable media storing computer-executable instructions that, when executed by the one or more processors, cause the system to perform operations comprising:
generating, by a context indexing component, indexed context information including project data associated with a user account, wherein the project data comprises at least existing computer code associated with a user account and the indexed context information is stored in a database configured to be queried by code generation agents;
receiving first data indicating that a trigger event has occurred, the trigger event indicating that initiation of generation of computer code in a computer code generation session is to occur;
identifying, based at least in part on attributes of the query, the existing computer code that is to be tested by the computer code generated in the computer code generation session;
selecting, based at least in part on the attributes of the trigger event, a code generation agent to generate the computer code;
retrieving, by the code generation agent, the indexed context information from the database;
generating test cases for the existing computer code based at least in part on the code generation agent that was selected; and
generating the computer code based at least in part on the test cases and the context indexing component processing the project data.

### Claim 2 (depends on 1)

The system of claim 1, the operations further comprising:
generating test results based at least in part on executing the computer code to test the existing computer code; and
sending data representing the test results to a device from which the query was received, the data causing the device to display the test results.

### Claim 3 (depends on 1)

The system of claim 1, the operations further comprising:
requesting, by the code generation agent, a refactoring component to provide an assessment of the existing computer code regarding testability;
determining, based at least in part on the assessment, that the existing computer code is below a threshold testability;
refactoring the existing computer code such that refactored existing computer code is generated; and
generating the test cases for the refactored existing computer code.

### Claim 4 (depends on 1)

The system of claim 1, wherein the code generation agent that was selected is from multiple code generation agents configured to generate the computer code for a given purpose, the given purpose including at least one of:
performing behavioral tests on the existing computer code; or
performing code-based tests on the existing computer code.

### Claim 5 (depends on 1)

The system of claim 1, the operations further comprising:
generating diagnostics data indicative of errors in the computer code based at least in part on a large language model (LLM) processing the existing computer code and the computer code;
generating, utilizing the LLM, hunks indicative of the errors in the computer code, wherein the errors are organized within the hunks based at least in part on types of the errors indicated by the diagnostics data;
patching the computer code utilizing the hunks such that patched computer code is generated;
sending second data representing the patched computer code to a device associated with the trigger event, the second data causing the device to display the patched computer code and receive user input associated with the patched computer code;
receiving third data representing the user input from the device, the user input indicating at least one of an acceptance of the patched computer code, a rejection of the patched computer code, or a modification associated with the patched computer code; and
sending a response to the device based at least in part on the third data.

### Claim 6 (depends on 1)

The system of claim 1, the operations further comprising:
generating the test cases for the existing computer code utilizing a large language model (LLM);
sending second data representing the test cases to a device associated with the trigger event, the second data causing the device to display the test cases and receive user input associated with the test cases;
receiving third data representing the user input from the device, the user input indicating at least one of an acceptance of the test cases, a rejection of the test cases, or a modification associated with the test cases; and
generating the computer code further based at least in part on the third data.

### Claim 7

A method comprising:
generating, by a context indexing component, indexed context information including project data associated with a user account, wherein the project data comprises at least existing computer code associated with a user account and the indexed context information is stored in a database configured to be queried by code generation agents;
receiving first data indicating that a trigger event has occurred, the trigger event indicating that initiation of generation of computer code in a computer code generation session is to occur;
identifying, based at least in part on attributes of the query, the existing computer code that is to be tested by the computer code generated in the computer code generation session;
selecting, based at least in part on the attributes of the trigger event, a code generation agent to generate the computer code;
retrieving, by the code generation agent, the indexed context information from the database;
generating test cases for the existing computer code based at least in part on the code generation agent that was selected; and
generating the computer code based at least in part on the test cases and the context indexing component processing the project data.

### Claim 8 (depends on 7)

The method of claim 7, further comprising:
generating test results based at least in part on executing the computer code to test the existing computer code; and
sending data representing the test results to a device associated with the trigger event, the data causing the device to display the test results.

### Claim 9 (depends on 7)

The method of claim 7, further comprising
requesting, by the code generation agent, a refactoring component to provide an assessment of the existing computer code regarding testability;
determining, based at least in part on the assessment, that the existing computer code is below a threshold testability;
refactoring the existing computer code such that refactored existing computer code is generated; and
generating the test cases for the refactored existing computer code.

### Claim 10 (depends on 7)

The method of claim 7, wherein the code generation agent that was selected is from multiple code generation agents configured to generate the computer code for a given purpose, the given purpose including at least one of:
performing behavioral tests on the existing computer code; or
performing code-based tests on the existing computer code.

### Claim 11 (depends on 10)

The method of claim 10, wherein:
the behavioral tests are determined based at least in part on at least one of:
method signatures in the existing code;
comments associated with the existing code; or
documentation associated with the existing code; and
the code-based tests are determined based at least in part on at least one of:
a body of code within a method of the existing code;
logic within the existing code; or
code paths within the existing code.

### Claim 12 (depends on 7)

The method of claim 7, further comprising
generating the test cases for the existing computer code utilizing a large language model (LLM);
sending second data representing the test cases to a device associated with the trigger event, the second data causing the device to display the test cases and receive user input associated with the test cases;
receiving third data representing the user input from the device, the user input indicating at least one of an acceptance of the test cases, a rejection of the test cases, or a modification associated with the test cases; and
generating the computer code further based at least in part on the third data.

### Claim 13 (depends on 7)

The method of claim 7, further comprising:
generating diagnostics data indicative of errors in the computer code based at least in part on a large language model (LLM) processing the existing computer code and the computer code;
generating, utilizing the LLM, hunks indicative of the errors in the computer code, wherein the errors are organized within the hunks based at least in part on types of the errors indicated by the diagnostics data;
patching the computer code utilizing the hunks such that patched computer code is generated;
sending second data representing the patched computer code to a device associated with the trigger event, the second data causing the device to display the patched computer code and receive user input associated with the patched computer code;
receiving third data representing the user input from the device, the user input indicating at least one of an acceptance of the patched computer code, a rejection of the patched computer code, or a modification associated with the patched computer code; and
sending a response to the device based at least in part on the third data.

### Claim 14

One or more non-transitory computer-readable media storing instructions that, when executed by one or more processors, cause the one or more processors to perform operations comprising:
generating, by a context indexing component, indexed context information including project data associated with a user account, wherein the project data comprises at least existing computer code associated with a user account and the indexed context information is stored in a database configured to be queried by code generation agents;
receiving first data indicating that a trigger event has occurred, the trigger event indicating that initiation of generation of computer code in a computer code generation session is to occur;
identifying, based at least in part on attributes of the query, the existing computer code that is to be tested by the computer code generated in the computer code generation session;
selecting, based at least in part on the attributes of the trigger event, a code generation agent to generate the computer code;
retrieving, by the code generation agent, the indexed context information from the database;
generating test cases for the existing computer code based at least in part on the code generation agent that was selected; and
generating the computer code based at least in part on the test cases and the context indexing component processing the project data.

### Claim 15 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, the operations further comprising:
generating test results based at least in part on executing the computer code to test the existing computer code; and
sending data representing the test results to a device associated with the trigger event, the data causing the device to display the test results.

### Claim 16 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, the operations further comprising
requesting, by the code generation agent, a refactoring component to provide an assessment of the existing computer code regarding testability;
determining, based at least in part on the assessment, that the existing computer code is below a threshold testability;
refactoring the existing computer code such that refactored existing computer code is generated; and
generating the test cases for the refactored existing computer code.

### Claim 17 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, wherein the code generation agent that was selected is from multiple code generation agents configured to generate the computer code for a given purpose, the given purpose including at least one of:
performing behavioral tests on the existing computer code; or
performing code-based tests on the existing computer code.

### Claim 18 (depends on 17)

The one or more non-transitory computer-readable media of claim 17, wherein:
the behavioral tests are determined based at least in part on at least one of:
method signatures in the existing code;
comments associated with the existing code; or
documentation associated with the existing code; and
the code-based tests are determined based at least in part on at least one of:
a body of code within a method of the existing code;
logic within the existing code; or
code paths within the existing code.

### Claim 19 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, the operations further comprising:
generating the test cases for the existing computer code utilizing a large language model (LLM);
sending second data representing the test cases to a device associated with the trigger event, the second data causing the device to display the test cases and receive user input associated with the test cases;
receiving third data representing the user input from the device, the user input indicating at least one of an acceptance of the test cases, a rejection of the test cases, or a modification associated with the test cases; and
generating the computer code further based at least in part on the third data.

### Claim 20 (depends on 14)

The one or more non-transitory computer-readable media of claim 14, further comprising:
generating diagnostics data indicative of errors in the computer code based at least in part on a large language model (LLM) processing the existing computer code and the computer code;
generating, utilizing the LLM, hunks indicative of the errors in the computer code, wherein the errors are organized within the hunks based at least in part on types of the errors indicated by the diagnostics data;
patching the computer code utilizing the hunks such that patched computer code is generated;
sending second data representing the patched computer code to a device associated with the trigger event, the second data causing the device to display the patched computer code and receive user input associated with the patched computer code;
receiving third data representing the user input from the device, the user input indicating at least one of an acceptance of the patched computer code, a rejection of the patched computer code, or a modification associated with the patched computer code; and
sending a response to the device based at least in part on the third data.
