AI Team Knowledge Base and Self-Verification Practices for Software Teams

    Large language models can perform well within a single session but do not automatically retain project conventions, historical defects, or team standards after the session ends. This article explains how software teams can capture that knowledge in project-level AI instruction files, what those files should contain, and how to give AI agents executable self-verification loops. It also covers how to make verification results trustworthy, a four-stage rollout plan, long-term investment priorities, and common implementation pitfalls.

    1. Why AI Collaboration Needs a Team-Level Knowledge Base

    Large language models often perform well within a single session, but after the session ends, they do not automatically retain project conventions, historical defects, and team standards. As a result, the same mistakes repeat: using deprecated APIs, ignoring directory structure conventions, and writing test environment configuration into production code.

    The solution is to capture experience in files and make every new session read them. These files usually live in the repository root and are maintained by the team. This article calls them “project-level AI instruction files.” Their audience differs from that of a README. A README is for new human team members, while an instruction file is for AI agents. Its content should emphasize executable rules and explicit prohibitions.

    2. What an Instruction File Should Contain

    An effective instruction file should contain at least the following five categories of information.

    1. Project overview: business goals, module boundaries, and version ranges of key dependencies.
    2. Build and test commands: list the exact commands for installation, build, test, and checks so AI does not have to guess.
    3. Coding conventions: naming rules, error handling, logging standards, and file placement.
    4. Known pitfalls: past errors, correct practices, and their causes.
    5. Prohibitions: for example, do not modify auto-generated files, and do not commit secrets or credentials.

    Below is an illustrative file fragment:

    1. # Project AI Instructions
    2. ## Build and Test
    3. - Install dependencies: `./scripts/setup.sh`
    4. - Run unit tests: `./scripts/test.sh unit`
    5. - Must pass before commit: `./scripts/lint.sh`
    6. ## Coding Conventions
    7. - Public interfaces return the structure `{code, message, data}`
    8. - Database access must go through the repository layer; controllers must not build SQL directly
    9. ## Known Pitfalls
    10. - Order service time fields use UTC, and time zones are converted in the presentation layer. Mixing time zones previously caused reconciliation differences.
    11. ## Prohibitions
    12. - Do not modify files under `generated/`
    13. - Do not write access credentials in code or logs

    The maintenance principle is simple: whenever AI makes a mistake and a human corrects it, add the correction to the file. The file should be short and accurate. Excessive length dilutes key information, so it is advisable to keep it within a few hundred lines and regularly remove outdated entries.

    3. Giving AI a Way to Self-Verify

    AI-generated code often looks plausible but fails to run. The key to improving output quality is to let AI verify its own results. Common verification methods include:

    • running unit tests and integration tests;
    • executing static checks and type checks;
    • starting the service, calling APIs, and comparing returned values;
    • comparing output item by item with expected sample files.

    These methods can form a closed loop: generate code, run checks, read failure information, fix the code, and check again until everything passes or a retry limit is reached. Below is an illustrative flow:

    1. Loop start
    2. 1. Modify code according to requirements
    3. 2. Run ./scripts/test.sh
    4. 3. If all checks pass, stop and report the result
    5. 4. If failures occur, read the error output and locate the root cause
    6. 5. If retries exceed 3, stop and request human intervention
    7. Loop end

    Setting a retry limit is necessary. Without a limit, AI may repeatedly attempt the same fix for one error, consuming significant time and compute resources without making progress.

    4. Making Verification Results Trustworthy

    Verification itself can also fail. When test coverage is insufficient, AI may “pass the tests” while leaving hidden risks. To make verification results trustworthy, teams need to do the following:

    • critical logic must have corresponding tests and cover boundary conditions;
    • AI must not delete or weaken assertions in order to pass tests;
    • test data must be strictly isolated from production data;
    • changes involving security, funds, or data migration must undergo human review.

    Among these, “prohibit weakening assertions” is the easiest to overlook. When encountering failing cases, AI sometimes modifies expected values to make the cases pass. Such changes are hard to spot during review, so they should be explicitly prohibited in the instruction file, and changes to test files should be a focus of code review.

    5. Implementation Steps for Teams

    Implementation can be advanced in four phases.

    Phase 1: review existing standards and create a minimal instruction file containing only build commands and prohibitions. The goal of this phase is to enable AI to correctly complete basic operations.

    Phase 2: complete automated tests and check scripts, and ensure that any team member can complete verification with a single command. If the verification steps themselves are unstable, AI self-checks cannot rely on them.

    Phase 3: review defects in AI output every week, add recurring issues to the instruction file, and record the frequency of each issue type.

    Phase 4: after verification coverage meets the target, gradually expand AI autonomy. For example, start with small changes in a single module, then attempt cross-module refactoring.

    6. A View on Technology Evolution

    AI capabilities improve quickly, and application scenarios often expand beyond expectations. Teams should not make long-term assumptions around the capabilities of one specific version. A more robust approach is to invest in assets that are independent of any specific model, including clear standards, automatically executable tests, and traceable change records. These assets remain valid after switching models or tools and directly improve human collaboration efficiency.

    7. Common Pitfalls

    • writing the instruction file as a long document, making it hard for AI to grasp the key points;
    • relying only on AI self-checks and lacking independent automated or human acceptance;
    • ignoring security boundaries and allowing AI to access production credentials;
    • writing the file once and never updating it, so its content gradually diverges from the code.