Updated on 2026-07-29 GMT+08:00

Knowledge Bases

CodeArts Agent improves chat features using knowledge bases. Developers can add internal documents and technical resources to these bases for smarter responses. With company-specific information, AI provides precise answers tailored to real-world needs, boosting both development speed and decision quality.

Getting Started with Knowledge Bases

CodeArts Agent leverages knowledge bases primarily for unit test generation, code generation, and R&D Q&A, dramatically enhancing both accuracy and speed across these critical scenarios.

The following figure shows the process of how the tool processes user queries into answers visually. It includes important stages like retrieving data and making logical conclusions, making it easy for you to grasp how knowledge bases work.

Figure 1 How knowledge bases work
  1. To fulfill service needs, knowledge is organized into distinct types, such as general, domain-specific, or individual expertise.
  2. You can create a knowledge space to manage knowledge bases.
  3. To create a knowledge base, upload desired files. Then, choose a chunking method to break data source into manageable pieces. Each chunk is then transformed into a vector by an embedding model.
  4. CodeArts Agent may reference knowledge bases for more accurate retrieval and generation.

Learn these key concepts before using knowledge bases for quick setup.

Table 1 Basic concepts

Basic Concept

Description

Knowledge space

A knowledge space is a collection of knowledge formed after chunking, vectorizing, indexing user-uploaded data, and storing it in a database. It is categorized based on actual usage dimensions. A knowledge space itself does not store content; it is used solely for the centralized management of knowledge bases.

Knowledge base

A knowledge base organizes and stores different types of documents. These documents are categorized by their type and source for clear classification, making them easier to find and understand.

File

Files serve as the primary carrier of knowledge. To ingest them into a knowledge base for retrieval, configure a proper chunking strategy, select an embedding model, apply index filters, and define retrieval policies.

Chunk

Chunks refer to portions of a file. They are created when loading and splitting a file, serving as fundamental units for vectorization, storage, and recall.

Constraints

File storage capacity limits vary across different versions of CodeArts Agent, as detailed below:

  • Basic edition: up to 5 GB
  • Professional edition: up to 20 GB

Prerequisites

  • You have been assigned a seat. If not, you cannot create or manage a knowledge space.
  • An enterprise administrator has joined a team, if they want to create a team knowledge base.

Accessing Knowledge Bases

  • Method 1: Use CodeArts Agent IDE.
    1. On the top menu bar of CodeArts Agent IDE, click to go to the global settings page.
    2. Click Knowledge Base to open the knowledge space page in an external browser.

      If you have not logged in to the CodeArts Agent console, the login page is displayed. After login, you can access the knowledge space page.

  • Method 2: Use a browser.

    Enter the knowledge space address in the browser and press Enter. The login page is displayed. Enter the username and password to log in to it.

Creating a Knowledge Base

  1. Create a knowledge space.

  2. Create a knowledge base.

  3. Import files.

Referencing a Knowledge Base in the Context

  1. Log in to CodeArts Agent IDE as instructed in Quick Start.
  2. In the input box on the chat panel, enter #, or choose > Add Context. Then choose Knowledge Bases.
  3. In the knowledge base list, select the knowledge space (for example, the individual knowledge space) created in 1.

    Figure 5 Selecting a knowledge space

  4. In the target knowledge space, select the knowledge base (for example, service introduction document) created in 3 and add it to the context.
  5. After the knowledge base is added, you can initiate a chat based on the knowledge base.

Managing Knowledge Bases

Table 6 shows the operation permissions of different roles on managing knowledge bases.

Table 6 Operation permissions of different roles on knowledge bases

Role

Enterprise Knowledge Base

Team Knowledge Base

User Knowledge Base

Enterprise administrators

All operations on all knowledge bases.

All operations on the knowledge bases of the team which the enterprise administrator belongs to.

All operations on the knowledge bases created by themselves.

Team administrators

The following operations can be performed:

  • Test hit rates of knowledge bases.
  • View operation history on knowledge bases.

All operations on knowledge bases created by members of their own team (including the team administrator).

All operations on the knowledge bases created by themselves.

Team members

The following operations can be performed:

  • Test hit rates of knowledge bases.
  • View operation history on knowledge bases.

The following operations can be performed on knowledge bases created by members of their own team (including the team administrator):

  • Test hit rates of knowledge bases.
  • View operation history on knowledge bases.

All operations on the knowledge bases created by themselves.

Enterprise members

The following operations can be performed:

  • Test hit rates of knowledge bases.
  • View operation history on knowledge bases.

No operation permissions.

All operations on the knowledge bases created by themselves.

Table 7 Managing knowledge bases

Operation

Procedure

Editing a knowledge space

On the knowledge space page, click on the target knowledge space and choose Edit.

Deleting a knowledge space

Before deleting a knowledge space, you must clear all knowledge bases in the space.

  1. On the knowledge space page, click on the target knowledge space and choose Delete. The Delete Knowledge Space dialog box is displayed.
  2. Click Autofill. The system automatically enters DELETE. Click OK to delete the knowledge space.
    The target knowledge space has been removed from the knowledge space page, indicating that the deletion was successful.
    CAUTION:

    Deleting a knowledge space will delete all resources within it. Once confirmed, data cannot be recovered; make a backup before this operation.

Testing the hit rate of a knowledge base

The hit rate test is designed to run search queries against the knowledge base to verify the accuracy and relevance of retrieval results.

  1. On the knowledge space page, click Hit Test in the upper right corner.
  2. Select up to 10 knowledge bases to be tested.
  3. Select the field to be retrieved from the drop-down list.
  4. Select a retrieval mode.
    • Text: Based on keyword matching; best suited for exact-word matches and short queries.
    • Vector: Based on semantic similarity; understanding context and synonyms, making it ideal for natural language queries.
    • Hybrid: Combining text and vector retrieval, using weighted fusion of both results. This generally yields better performance, especially for complex semantic queries.
  5. Enter the content you want to search (maximum 1,000 characters).
  6. Set the number of returned results.
  7. Click Debug. You can view the final results under Chunks.

Deleting a knowledge base

When content is severely outdated and holds no retention value, or contains critical errors where correction is too costly or impossible, follow the steps below to delete the knowledge base.

  1. On the knowledge space page, click the knowledge space where the target knowledge base is located to view its details.
  2. Locate the row that contains the target knowledge base, and click Delete. The Delete Knowledge Base dialog box is displayed.
  3. Click Autofill. The system automatically enters DELETE. Click OK to delete the knowledge base.
    The target knowledge base has been removed from the knowledge space details page, indicating that the deletion was successful.
    CAUTION:

    Deleting a knowledge base will delete all data within it. The deleted data cannot be recovered. Ensure that you have backed up important data before this operation.

Batch deleting knowledge bases

Deleting knowledge bases one by one manually is inefficient; you can batch delete knowledge bases through the following steps:

  1. On the knowledge space page, click the knowledge space where the target knowledge base is located to view its details.
  2. Click Batch Delete in the upper right corner and select the target knowledge bases.
  3. Click Delete. The Batch Delete Knowledge Bases dialog box is displayed.
  4. Click Autofill. The system automatically enters DELETE. Click OK to delete the knowledge bases.
    The target knowledge bases have been removed from the knowledge space details page, indicating that the deletion was successful.
    CAUTION:

    Deleting a knowledge base will delete all data within it. The deleted data cannot be recovered. Ensure that you have backed up important data before this operation.

Viewing operation history on knowledge bases

  1. On the knowledge space page, click the knowledge space where the target knowledge base is located to view its details.
  2. Click History in the upper right corner to view the operation logs of all knowledge bases in the knowledge space.

Re-importing a file

If file upload fails, check your network connection or file format, and click Reimport to try again.

  1. On the knowledge space page, click the knowledge space where the target knowledge base is located to view its details.
  2. Click the name of the target knowledge base to view its details.
  3. Click Reimport in the upper right corner and view the import result.

Deleting a file

When dealing with a small number of files, deleting them one by one is more intuitive and flexible, making it easier to locate and clear specific content.

  1. On the knowledge space page, click the knowledge space where the target knowledge base is located to view its details.
  2. Click the name of the target knowledge base to view its details.
  3. Click Delete next to the target file. The Delete File dialog box is displayed.
  4. Click Autofill. The system automatically enters DELETE. Click OK to delete the file.
    The target file has been removed from the knowledge base details page, indicating that the deletion was successful.
    CAUTION:

    Deleted files will be permanently cleared and cannot be recovered. Ensure that you have backed up important data before this operation.

Batch deleting files

Deleting many files one by one manually is inefficient; you can also batch delete files using the following steps: This is ideal for scenarios such as knowledge base restructuring, version iterations, and deduplication, helping you keep your knowledge base organized.

  1. On the knowledge space page, click the knowledge space where the target knowledge base is located to view its details.
  2. Click the name of the target knowledge base to view its details.
  3. Click Batch Delete in the upper right corner and select the target files.
  4. Click Delete. The Batch Delete Files dialog box is displayed.
  5. Click Autofill. The system automatically enters DELETE. Click OK to delete the files.
    The target files have been removed from the knowledge base details page, indicating that the deletion was successful.
    CAUTION:

    Deleted files will be permanently cleared and cannot be recovered. Ensure that you have backed up important data before this operation.