KB Scoring System
Five dimensions scored independently, then combined into a composite.
1. Quality
Does each artifact meet its rubric? Weighted gates per artifact type.
Card Quality (max 11 points)
| Gate | Weight | Pass Condition |
|---|---|---|
| Function coverage | 2 | Every non-static function in table |
| Line numbers | 1 | Match current source (+/-10 tolerance) |
| Call graph | 2 | ASCII call graph present and correct |
| Algorithm | 2 | Numbered steps describing core logic |
| Constants | 1 | All thresholds listed with actual values |
| Cross-references | 1 | Dependencies link to other cards by ID |
| Frontmatter | 1 | All required YAML fields present |
| No placeholders | 1 | No TODO/TBD/??? remaining |
API Documentation Quality (max 8 points)
Applies to Doxygen (C/C++) or Sphinx (Python) depending on
project-config.md->docs_tool.
| Gate | Weight | Doxygen (C/C++) | Sphinx (Python) |
|---|---|---|---|
| Coverage | 3 | Every non-static function has a block | Every public function/method has a docstring |
| Parameters | 2 | Every param annotated with direction | Every param has :param: + :type: |
| Cross-refs | 1 | @see links with card IDs |
.. seealso:: with card IDs |
| Site generated | 1 | HTML output exists and is not stale | HTML output exists and is not stale |
| Call graphs | 1 | Caller/callee graphs render | Call graph artifacts exist |
Math Quality (max 4 points)
| Gate | Weight | Pass Condition |
|---|---|---|
| Builds | 1 | LaTeX compiles without errors |
| Card refs | 1 | Card IDs reference existing cards |
| Code refs | 2 | Constants/thresholds match source |
Aggregation
Missing artifacts score 0 but count toward the denominator.
2. Coverage
where \(C_\text{file}\) is the fraction of applicable artifacts present per file, and \(C_\text{func}\) is the fraction of non-static functions documented.
Math applicability is configurable per category in project-config.md.
3. Consistency
Pairwise checks, each pass/fail:
| Check | Description |
|---|---|
| Card-Doxy | Function purposes align with @brief |
| Card-Math | Constants/thresholds match |
| Bidirectional refs | A refs B implies B refs A |
| INDEX links | All links resolve to existing files |
| SYNCLOG | Entries match actual artifacts |
| Library citations | [library:{key}] refs resolve to library INDEX entries |
| Library integrity | Every INDEX entry has a file; every file has an entry |
| INDEX docs links | Docs column links resolve to existing HTML files |
| Card-docs call graph | Card Call Graph consistent with generated call graph |
4. Freshness
Uses a 7-day staleness threshold (configurable in project-config.md).
5. Transfer
Measured by shadow validation — how well the KB enables reimplementation. See Shadow Validation for the full protocol.
Per module:
Gap classification: Missing, Ambiguous, Incorrect, Implicit.
When no shadow runs exist: Transfer is excluded from the composite and the remaining four dimensions use their original weights (0.30/0.30/0.20/0.20).
Composite
Without Transfer data:
| Range | Grade |
|---|---|
| 90-100% | A |
| 75-89% | B |
| 50-74% | C |
| 25-49% | D |
| 0-24% | F |