Updated on 2026-09-17 GMT+08:00

Knowledge Space Management

You can upload enterprise internal documents and technical materials to the Knowledge Space page for unified management. The knowledge can serve as contextual reference to improve the accuracy of the agent's responses. Knowledge spaces can only be created and managed on the console, and only accounts with seats enabled can perform related operations.

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, organize your knowledge into distinct types, such as general, domain-specific, or individual expertise.
  2. Create a knowledge space to manage knowledge bases.
  3. Upload desired files to create a knowledge base. 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 can then 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

Table 2 Constraints

Package Edition

Max Capacity

Type of Knowledge Space Can Be Created

Free Edition

500 MB

User

Basic Edition

5 GB

Enterprise, Team, and User

Professional Edition

20 GB

Enterprise, Team, and User

Prerequisites

You have been assigned a seat. If not, you cannot create or manage a knowledge space.

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 the client as an enterprise member or administrator.
  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, individual) created in 1.

    Figure 5 Selecting a knowledge space

  4. In the target knowledge space, select the knowledge base (for example, service-introduction) 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 7 shows the operation permissions of different roles on managing knowledge bases.

Table 7 Operation permissions of different roles on knowledge bases

Role

Enterprise Knowledge Base

Team Knowledge Base

User Knowledge Base

Enterprise administrator

All operations on all knowledge bases.

All operations on all knowledge bases.

All operations on all knowledge bases.

Team administrator

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 administrators).

All operations on the knowledge bases created by themselves.

Team member

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 member

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 8 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. Enter DELETE or click Autofill, and then 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.

Test hit rates of knowledge bases.

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. Enter DELETE or click Autofill, and then click OK to delete the target 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. Select the target knowledge bases and click Batch Delete in the upper right corner. The Batch Delete Knowledge Bases dialog box is displayed.
  3. Enter DELETE or click Autofill, and then click OK to delete these 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.

View 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 file is located to view the knowledge space details.
  2. Click the name of the knowledge base where the target file is located to view the knowledge base details.
  3. Click Delete next to the target file. The Delete File dialog box is displayed.
  4. Enter DELETE or click Autofill, and then 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 file is located to view its details.
  2. Click the name of the knowledge base where the target file is located to view the knowledge base details.
  3. Select the target files and click Batch Delete in the upper right corner. The Batch Delete Files dialog box is displayed.
  4. Enter DELETE or click Autofill, and then click OK to delete these 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.