General AI Agent Architecture: How Entry Governance and Experience Capture Work Together

    This article breaks down two distinct engineering focuses in general AI agent systems: entry governance and experience capture. It explains why treating them as either-or choices is a mistake, compares rule-driven skill libraries with self-learning skill capture, contrasts static file-based memory with a three-layer, retrieval-based memory architecture, and outlines common pitfalls and practical criteria for deciding which layer to prioritize. Readers will find a layered collaboration model, illustrative YAML and SQL examples, and guidance on building agents that are both well-governed and continuously improving.

    1. The Problem: Why “Either-Or” Is the Wrong Question

    In discussions about choosing a general-purpose AI agent system, a common mistake is to frame two systems with different engineering priorities as competing options in a single multiple-choice question. Both share the same technical foundation: a large language model handles reasoning and generation, a loop drives multi-step progress, and a runtime harness manages tool invocation, context assembly, and error recovery. However, their engineering goals differ. One type of system addresses “who can get in, how tasks are assigned, and what is allowed or disallowed.” The other addresses “how to turn the process into reusable assets after the work is done.” This is similar to the relationship between a front-end entry point and a back-end knowledge base: not a replacement, but a layered structure.

    For this reason, this article avoids specific product names and abstracts the problem into two technical propositions: entry-governance agents and experience-capture agents. The former emphasizes order; the latter emphasizes the learning curve.

    2. Capability Layers: Two Forms of the Skill System

    2.1 Rule-Driven Skill Libraries

    In entry-governance systems, skills are essentially rules written explicitly by people: install and register capabilities, define functional boundaries, agree on input/output contracts, and grant permissions at the system, team, and personal levels. The upper limit depends on the quality of the governance design. When rules are vague, execution results are naturally unstable. A sample capability declaration can be written as:

    1. skill:
    2. name: report_builder
    3. scope: team # system | team | personal
    4. inputs: {dataset: uri, period: string}
    5. outputs: {file: uri}
    6. permissions: [read_dataset, write_object_storage]
    7. on_violation: reject_and_log

    2.2 Self-Learning Skill Capture

    The key difference in experience-capture systems is that skills are not only written by people; the system can also automatically distill them from successful trajectories, turning “how it worked this time” into steps that can be invoked directly next time. In engineering practice, this usually requires three elements: trajectory collection, success determination, and skill sealing with version management. Without success determination, capture will treat accidental success as experience and contaminate the skill library.

    Conclusion: the former is a team standardization manual; the latter is a personal experience notebook. The manual guarantees the lower bound; the notebook raises the upper bound.

    3. Memory Architecture: Static Files vs. a Retrieval-Based Brain

    3.1 The Risks of Static Memory

    Rule-based systems often store memory in several Markdown files: role settings, user preferences, curated scenarios, and logs archived by date. The problem is not the format but the lack of indexing and eviction mechanisms: files grow longer and longer, reference relationships become harder to untangle, and retrieval hits depend entirely on manual maintenance. Most users have never truly designed a memory system; when they simply use the default configuration, the results are often poor.

    3.2 Three Memory Layers and a Four-Step Loop

    Experience-capture solutions typically use three memory layers: session memory keeps the current conversation coherent; persistent memory stores long-term preferences and behavior patterns; skill memory stores the operational paths of successful tasks. The loop can be summarized as follows:

    1. Execute: run the full task workflow to completion.
    2. Record: keep a complete trace of inputs, actions, mid-course adjustments, and final results.
    3. Index: build a full-text search index over the text (SQLite’s FTS5 capability is commonly used in the industry), supporting keyword and snippet recall.
    4. Reuse: when a similar task is hit, first recall the historical path, then decide whether to create a new skill.
    1. -- Example: build a full-text index for interaction records
    2. CREATE VIRTUAL TABLE trace_fts USING fts5(content, session_id UNINDEXED);
    3. INSERT INTO trace_fts(content, session_id) VALUES ('generate and archive weekly report', 's-1024');
    4. SELECT content FROM trace_fts WHERE trace_fts MATCH 'weekly AND archive' LIMIT 5;

    4. Common Pitfalls and Decision Criteria

    • Pitfall 1: treating entry governance as the whole of intelligence. No matter how complete the rules are, they will not automatically make the agent more proficient.
    • Pitfall 2: treating automatic capture as governance-free. Without permissions and boundaries, capture will amplify erroneous operations.
    • Pitfall 3: piling up memory without eviction. Without summarization, deduplication, and expiration policies, retrieval quality will keep declining.

    The decision criteria can be simplified into three questions: Is the task repeatable? Is the process fully recorded? Can successful experience be retrieved and reused? If the answer to all three is no, prioritize governance. If the answer to all three is yes, prioritize capture.

    1. Foundation layer: unify the runtime and tool integration, and centralize authentication, auditing, and rate limiting.
    2. Governance layer: define skill contracts, input/output validation, tiered authorization, and violation-rejection policies.
    3. Capture layer: enable trajectory recording, full-text indexing, automatic skill sealing, and human review.
    4. Operations layer: use logging services and monitoring alerts to observe success rate, reuse rate, and average number of steps, review weekly, and write rules back.

    If a relatively mature rule system is already in place, prioritize filling in memory and capture. If there is already a large amount of personal experience but a lack of boundaries, prioritize governance first. If elastic compute and storage are needed, a container platform can host the runtime and object storage can hold trajectories and skill packages, which falls under general cloud capabilities.

    6. Conclusion

    Entry governance determines whether an agent “can be found and works by the rules,” while experience capture determines whether it “gets more proficient over time.” They are two orthogonal dimensions of the same system, and only their combination forms a complete solution.