Skip to content

fleet-standard: .terraphim knowledge stack (roles, KG, thesauri, skills manifest, memory) - #957

Merged
AlexMikhalev merged 6 commits into
mainfrom
fleet/terraphim-knowledge-stack
Aug 8, 2026
Merged

fleet-standard: .terraphim knowledge stack (roles, KG, thesauri, skills manifest, memory)#957
AlexMikhalev merged 6 commits into
mainfrom
fleet/terraphim-knowledge-stack

Conversation

@AlexMikhalev

Copy link
Copy Markdown
Contributor

Fleet standard §8 rollout (private/cto-executive-system doc 2026-08-08-rust-fleet-standard.md).

  • .terraphim/config.json: two roles — Terraphim AI Developer (taidev) + Terraphim AI Architect (taiarch), terraphim-graph relevance, haystacks: repo root, crates/, docs/, memory/
  • kg-taidev/ (10 concepts: automata, rolegraph, persistence, haystacks, agent, orchestrator, mcp, session, hooks, config) + kg-taiarch/ (5: KG, relevance, roles, privacy, search pipeline)
  • Compiled thesauri (80 + 31 terms), auto-discovered by terraphim-grep
  • skills.toml: required/recommended tsm skills for agents in this repo
  • scripts/bootstrap.py: rebases config paths to local clone + regenerates thesauri (idempotent)
  • memory/README.md: repo-local agent memory convention

…rraphim

Extends the in-repo .terraphim layout (Rust Engineer + kg/<role>/) with
fleet-standard §8 roles without replacing them:

- Terraphim AI Developer (taidev) + Architect (taiarch)
- Domain KG concepts under kg-taidev/ and kg-taiarch/
- Committed thesauri + skills.toml (tsm names verified 2026-08-08)
- bootstrap.py materializes {REPO} placeholders and refreshes fleet thesauri
- memory/ repo-local agent notes

Config stays portable: new roles use {REPO} haystacks/KG paths; existing
Rust Engineer keeps relative paths. Default role unchanged (Rust Engineer).

Refs fleet-standard §8
@AlexMikhalev
AlexMikhalev force-pushed the fleet/terraphim-knowledge-stack branch from e851679 to 552e8da Compare August 8, 2026 11:47
taidev/taiarch haystacks and KG paths are repo-relative; bootstrap only
regenerates thesauri and normalizes absolutes back to relative — never
writes machine paths into tracked config.json.

Refs fleet-standard §8
Structural review P1: top-level id "TerraphimAI" is not a ConfigId variant
(Server/Desktop/Embedded) and breaks strict Config::load_from_json_file.
ProjectConfig ignores it; remove rather than invent a value.

P2: synonym first-wins now warns; JSON files end with newline.
Preserve legacy kg/rust-engineer path.

Refs fleet-standard §8
…wlines

R2 structural review:
- P1: suffix heuristic rewrote foreign haystacks ending in /docs,/crates,etc.
  Now requires realpath containment under REPO; foreign paths left untouched.
- P2: thesaurus json.dump now writes trailing newline (stays fixed on regen)
- P2: clean Path portability README section (remove duplicate fragment)

Refs fleet-standard §8
@AlexMikhalev

Copy link
Copy Markdown
Contributor Author

🤖 structural-pr-review (claude sonnet) · R4 final · independent of authoring model

Summary

This PR adds two new fleet-standard Terraphim roles ("Terraphim AI Developer" / taidev and "Terraphim AI Architect" / taiarch) to .terraphim/config.json, along with their knowledge-graph source files, generated thesauri, a bootstrap.py regeneration/path-normalization script, a skills manifest, and a repo-scoped memory/ directory for agent notes.

  • config.json: adds two role blocks with repo-relative haystacks (., crates, memory, docs, .docs) and terraphim-graph relevance, coexisting with the pre-existing Rust Engineer role.
  • bootstrap.py: idempotent thesaurus compiler + path normalizer that only rewrites .terraphim/kg-<shortname>/ fleet layouts, explicitly leaves the legacy kg/<role>/ layout untouched, and refuses to ever write a machine-absolute path back into tracked config.
  • kg-taidev/, kg-taiarch/: ten and five single-purpose concept files respectively, each with a synonyms:: line, matching the thesaurus generation contract.
  • thesaurus-taidev.json, thesaurus-taiarch.json: generated output; term→id→nterm mappings verified consistent with bootstrap.py's glob order and collision handling.
  • memory/README.md: documents the new repo-local, ripgrep-searchable agent memory convention.

What was done well: the diff is tightly scoped (only .terraphim/ and memory/), the bootstrap script is idempotent and defensively avoids clobbering the legacy Rust Engineer KG layout or foreign absolute haystack paths, and the generated thesauri are internally consistent with their source markdown.

This is round 3. The single R3 finding — config.json/thesaurus write-back missing a trailing newline (P2) — is fixed in 905f1d9ac: both compile_thesaurus() and the config.json writer in bootstrap.py now call fh.write("\n") after json.dump(..., indent=2), matching the existing thesaurus-writer convention elsewhere in the codebase. No other issues were found in this pass; all P0/P1 findings from prior rounds remain resolved.

Confidence Score: 5/5

  • Safe to merge with minimal risk.
  • Zero P0, zero P1, zero P2. The only outstanding item from R2/R3 (trailing-newline consistency on config.json/thesaurus write-back) is fixed and verified against the diff. The diff is scoped exactly to .terraphim/ and memory/ as required, JSON structure in config.json is valid, and the generated thesauri match their source synonyms:: markdown deterministically.
  • No files require special attention.

Important Files Changed

Filename Overview
.terraphim/config.json Adds Terraphim AI Developer / Terraphim AI Architect role blocks with repo-relative haystacks; JSON structure valid, no findings.
.terraphim/scripts/bootstrap.py Regenerates thesauri and normalizes paths; trailing-newline fix (R3 P2) confirmed present for both the thesaurus writer and the config.json writer; legacy kg/<role>/ layout and foreign absolute paths correctly left untouched.
.terraphim/README.md Documents fleet roles and path-portability contract; doc-only, no issues.
.terraphim/skills.toml New skills manifest (required/recommended lists); informational, no logic.
.terraphim/kg-taidev/*.md, .terraphim/kg-taiarch/*.md 15 single-concept KG source files, each with a synonyms:: line; content verified to compile correctly via bootstrap.py.
.terraphim/thesaurus-taidev.json, .terraphim/thesaurus-taiarch.json Generated output; term/id/nterm mappings cross-checked against source markdown and glob ordering — consistent.
memory/README.md New repo-local agent memory convention doc; consistent with the memory haystack added in config.json.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[bootstrap.py run] --> B{For each role in config.json}
    B --> C{fleet kg-<shortname>/ dir exists?}
    C -->|yes| D[Force kg.path = .terraphim/kg-<shortname>]
    C -->|no, legacy kg path| E[Normalize via to_repo_relative<br/>never collapses to root]
    D --> F{For each haystack location}
    E --> F
    F --> G[to_repo_relative]
    G --> H{Absolute path?}
    H -->|resolves inside repo| I[Rewrite to repo-relative]
    H -->|foreign / outside repo| J[Leave untouched]
    F --> K{fleet kg dir exists?}
    K -->|yes| L[compile_thesaurus:<br/>glob *.md sorted, parse synonyms::,<br/>warn on cross-file key collision]
    L --> M[Write thesaurus-shortname.json<br/>json.dump indent=2 + trailing newline]
    I --> N{Any config change?}
    J --> N
    N -->|yes| O[Write config.json<br/>json.dump indent=2 + trailing newline]
    N -->|no| P[No-op: already portable]

    style M fill:#d4edda,stroke:#28a745
    style O fill:#d4edda,stroke:#28a745
Loading

Footer

Last reviewed commit: 905f1d9 | Reviews (3)

Findings: P0=0 P1=0 P2=0

@AlexMikhalev
AlexMikhalev merged commit 8206dbc into main Aug 8, 2026
1 check passed
@AlexMikhalev
AlexMikhalev deleted the fleet/terraphim-knowledge-stack branch August 8, 2026 12:09
AlexMikhalev pushed a commit that referenced this pull request Aug 11, 2026
GitHub commits merged:
- 552e8da feat: add fleet taidev/taiarch knowledge stack alongside existing .terraphim
- 14d4a97 fix: fleet roles use repo-relative paths (match migration P2 fix)
- 222f068 fix: bootstrap preserves legacy kg/<role>/ paths (do not clobber Rust Engineer)
- a688b00 fix: drop invalid Config id; warn synonym collisions; trailing newlines
- 9969458 fix: bootstrap only rewrites in-repo absolute paths; JSON trailing newlines
- 905f1d9 fix: trailing newline on config.json write-back (R3 P2)
- 8206dbc Merge pull request #957 from terraphim/fleet/terraphim-knowledge-stack

Conflict: .terraphim/skills.toml — merged both sides' skill lists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant