Core components
Overall data path
Three kinds of objects in this chain play different roles:- Project evidence — the source code, configuration, tests, documents, and verification results in the current repository — is the direct source of project facts.
- Project Knowledge Record is the normalized Project Model or Project Policy built from that evidence.
- The SQLite FTS index can be rebuilt at any time; it exists to make candidate recall faster.
Corpus: the project corpus scope
The Corpus defines which Markdown sources the Local Provider can split, index, and retrieve. The default sources include:- The Native current Spec and Archive;
- The Classic current Spec and Archive;
- Comet-supported workflow artifacts;
- The Markdown paths explicitly added in the configuration.
knowledge.local.include:
include uses globs relative to the project root. The system splits documents into source units with path and section information, which retrieval and source-state checks use.
The default corpus only contains sources Comet can identify clearly. Rule files or rule directories the target platform supports are managed by the platform; if you also want their Markdown as knowledge corpus, add it explicitly through include.
Source code, manifests, configuration, and tests can help build Project Models and remain as record evidence, but do not enter the Markdown retrieval corpus directly. The Dashboard corpus page shows the Markdown used for retrieval; other evidence is available in the corresponding knowledge records.
Formation logic: base model and execution accumulation
Project Model Builder
On first project use, the Project Model Builder builds a base Project Model from the manifest, configuration, directory structure, limited source relationships, and custom Markdown. Laterrepository.changed, verification.completed, and change.archived events update these records.
Project Model only keeps structural information that can be extracted deterministically:
topology: directory, module, and workspace topology;fact: facts checkable against the current project;dependency: relationships between modules, packages, and components.
proven (confirmed) state directly and keeps its sources for re-checking before a task uses it. It is made of structured knowledge records; it never becomes a directory-style or chapter-style Wiki of the whole project.
Project Policy Learner
The Project Policy Learner processes engineering experience accumulated during task execution:
Experiences that need interpretation go to the host Agent for review by default; see Project Knowledge for usage. Newly distilled policies start in
trial and are promoted to proven after helping later tasks successfully. Source refresh does not replace validation through actual use.
Record: the traceable knowledge unit
A Project Knowledge Record contains at least the following:
The system judges whether multiple records point to the same thing by content: updating content creates a new version and keeps its relationship with the old version, which reduces near-duplicate entries. Content you explicitly corrected has higher authority; automatic distillation can only add evidence or form a pending version.
Policy Compiler: policy activation
The Policy Compiler chooses how a Project Policy is activated, based on whether the content can be judged programmatically and how it will be used:- Context: a
decision,pattern,procedure, orconstraintthat needs the Agent to judge it against the task is provided as a full policy or through the Context Manifest. - Verification: a
constraintbound to a runnable project command whose success or failure can be judged is provided as a verification policy. - Skill candidate: when a
procedureis stable across tasks, has several steps, and can be composed, an evidence-based Skill candidate summary is generated.
enforced, and it must be bound to a deterministic verification entry that currently exists and has run successfully. enforced means the policy has a runnable verification binding; it never expands model or system permissions.
Hybrid retrieval
Project tasks carry several kinds of retrieval signals:- Precise paths, commands, error codes, and identifiers fit strong string matching;
- Chinese descriptions, section titles, and engineering semantics fit full-text search;
- Module responsibilities and cross-file impact fit structural filtering and bounded relationship expansion;
- Current-branch changes and stale sources need on-site verification.
Source-validity checks
Before a record enters context, the system checks the project-relative source, anchor, digest, or version:- When the source exists and its content is unchanged, the record keeps participating in retrieval.
- When the source changed, the old record stops being used as the current conclusion.
- When the source is deleted, a selector stops applying, or a verification command disappears, the record enters
superseded. - New evidence forms a new version and keeps its replacement relationship with the old version.
Context Director: task context control
The Provider query returns a candidate set. Context Director then applies a second layer of selection:- Drops candidates that do not match the current project, path, task, operation, or phase;
- Excludes
superseded; - Ranks
provenandenforcedahead oftrial; - Ranks repository-level sources and records you explicitly provided ahead of automatic inference;
- Ranks specific scopes and recently successful applications higher;
- Ranks corrected or failure-involved content lower.
trial policies, long procedures, and evidence usually enter the Context Manifest.
The Manifest uses stable IDs and carries:
- Title and summary;
- Knowledge type and lifecycle;
- Source type;
whyApplied;- Application ID.
expand. The per-task character budget limits only the content injected for the current task, never the total records the Provider holds.
Main workspace and linked worktrees
The Local Provider tells projects apart with a stable repository identity:- The main workspace and linked worktrees of the same repository share the normalized Records;
- Document sections and full-text indexes are isolated per workspace;
- File changes in a branch or worktree affect only that workspace’s source snapshot;
- Different repositories are isolated from each other.
Local and Remote Providers
The Project Knowledge domain accesses the Provider through the unifiedstatus / query / apply contract.
Local Provider
- Uses per-repository-ID SQLite in the user data directory;
- Records store the structured state Comet maintains automatically;
- Section and FTS indexes can be rebuilt;
- Bounded ripgrep handles strong matches, changed-file supplement, and failure fallback.
Remote Provider
- Once Remote is enabled, Local is no longer read at the same time;
- Queries send only bounded task, path, phase, operation, and ID selectors;
- apply sends only normalized Records and evidence;
- Full repositories, full diffs, logs, Personal Memory, and credentials never enter a request;
- A Remote failure returns the actual state and does not switch to Local.
Execution boundaries with Rule, Hook, and engineering checks
You can keep writing project constraints in the Rule carriers your target platform supports; the platform still loads them. Codex
AGENTS.md, Claude Code CLAUDE.md, and Cursor .cursor/rules are only concrete examples. Comet reuses these Rules and the project’s existing checks: Project Knowledge records why a constraint exists, where it applies, and which verification command enforces it, while the deterministic judgment stays with the corresponding executor.
Failure behavior
Return to Project Knowledge, or continue with Agent Learning Loop.

