From ee4f5beacfdb1c44706faeec55c7730b6ca4cac1 Mon Sep 17 00:00:00 2001 From: Matteo Cherubini Date: Wed, 3 Jun 2026 12:28:18 +0200 Subject: [PATCH] feat: add linked project field to genome registry --- lib/scaffold.sh | 18 +++++++++++------- registry.sh | 12 ++++++++---- scripts/add-genome.sh | 6 ++++-- scripts/setup-genomes.sh | 5 +++-- templates/agents-genome.md | 22 ++++++++++++++++++---- 5 files changed, 44 insertions(+), 19 deletions(-) diff --git a/lib/scaffold.sh b/lib/scaffold.sh index 5add2ed..b9dc437 100644 --- a/lib/scaffold.sh +++ b/lib/scaffold.sh @@ -16,17 +16,21 @@ render_template() { local content content=$(<"$template_file") + # Defaults (:-) so master-repo templates render even when GENOME_* are unset + # (scaffold_master runs before any genome; set -u would otherwise abort here). local genome_name_upper - genome_name_upper=$(tr '[:lower:]' '[:upper:]' <<< "${GENOME_NAME}") + genome_name_upper=$(tr '[:lower:]' '[:upper:]' <<< "${GENOME_NAME:-}") # Placeholder replacement - content="${content//\{\{GENOME_NAME\}\}/${GENOME_NAME}}" + content="${content//\{\{GENOME_NAME\}\}/${GENOME_NAME:-}}" content="${content//\{\{GENOME_NAME_UPPER\}\}/${genome_name_upper}}" - content="${content//\{\{GENOME_DESC\}\}/${GENOME_DESC}}" - content="${content//\{\{FORGEJO_URL\}\}/${FORGEJO_URL}}" - content="${content//\{\{FORGEJO_USER\}\}/${FORGEJO_USER}}" - content="${content//\{\{VAULTWARDEN_URL\}\}/${VAULTWARDEN_URL}}" - content="${content//\{\{MASTER_REPO\}\}/${MASTER_REPO}}" + content="${content//\{\{GENOME_DESC\}\}/${GENOME_DESC:-}}" + content="${content//\{\{FORGEJO_URL\}\}/${FORGEJO_URL:-}}" + content="${content//\{\{FORGEJO_USER\}\}/${FORGEJO_USER:-}}" + content="${content//\{\{VAULTWARDEN_URL\}\}/${VAULTWARDEN_URL:-}}" + content="${content//\{\{MASTER_REPO\}\}/${MASTER_REPO:-}}" + # linked project reference (optional) — empty registry field renders as 'none' + content="${content//\{\{LINKED_PROJECT\}\}/${GENOME_LINKED:-none}}" content="${content//\{\{DATE\}\}/$(date +%Y-%m-%d)}" mkdir -p "$(dirname "$output_file")" diff --git a/registry.sh b/registry.sh index 88513f5..1d5c994 100644 --- a/registry.sh +++ b/registry.sh @@ -19,9 +19,13 @@ LIB_DIR="${PROJECT_ROOT}/lib" PROVIDERS_DIR="${PROJECT_ROOT}/providers" # --- GENOME REGISTRY --- -# Format: "name|description" +# Format: "name|description|linked_repo" +# - linked_repo is OPTIONAL. Leave empty (trailing pipe) for knowledge-only genomes. +# - It is an opaque reference rendered verbatim into the genome's AGENTS.md +# (phase-2 project work is parked, so the framework does not act on it yet). +# - Example with a project: "genome-homelab|Keru infrastructure...|keru/homelab-infra" GENOMES=( - "genome-dev|Web development, TUI, Angular, software architecture" - "genome-finance|Personal finance, investments, market analysis" - "genome-homelab|Keru infrastructure, network configs, architecture logs" + "genome-dev|Web development, TUI, Angular, software architecture|" + "genome-finance|Personal finance, investments, market analysis|" + "genome-homelab|Keru infrastructure, network configs, architecture logs|" ) diff --git a/scripts/add-genome.sh b/scripts/add-genome.sh index 37dab87..53cab5d 100644 --- a/scripts/add-genome.sh +++ b/scripts/add-genome.sh @@ -11,16 +11,18 @@ source "registry.sh" GENOME_NAME="${1:-}" GENOME_DESC="${2:-}" +GENOME_LINKED="${3:-}" # optional: linked project repo reference if [[ -z "$GENOME_NAME" || -z "$GENOME_DESC" ]]; then error "Missing arguments." - echo "Usage: $0 " + echo "Usage: $0 [linked-repo]" exit 1 fi step "Adding New Genome: ${GENOME_NAME}" -GENOMES=("${GENOME_NAME}|${GENOME_DESC}") +# Build a 3-field registry entry (linked_repo may be empty) +GENOMES=("${GENOME_NAME}|${GENOME_DESC}|${GENOME_LINKED}") source "scripts/setup-genomes.sh" diff --git a/scripts/setup-genomes.sh b/scripts/setup-genomes.sh index c5c3999..c6c7975 100644 --- a/scripts/setup-genomes.sh +++ b/scripts/setup-genomes.sh @@ -19,8 +19,9 @@ source "providers/${PROVIDER}.sh" step "Processing Genome Registry" for entry in "${GENOMES[@]}"; do - IFS='|' read -r GENOME_NAME GENOME_DESC <<< "$entry" - export GENOME_NAME GENOME_DESC + # 3-field format: name|description|linked_repo (linked_repo optional → may be empty) + IFS='|' read -r GENOME_NAME GENOME_DESC GENOME_LINKED <<< "$entry" + export GENOME_NAME GENOME_DESC GENOME_LINKED info "Processing: ${GENOME_NAME}..." diff --git a/templates/agents-genome.md b/templates/agents-genome.md index a5f7f86..4ecbda4 100644 --- a/templates/agents-genome.md +++ b/templates/agents-genome.md @@ -14,14 +14,28 @@ --- +## Linked Project + +| Field | Value | +| --------------- | --------------------- | +| Project repo | `{{LINKED_PROJECT}}` | +| Branch | `main` | +| Allowed tasks | `readme, tests, code` | +| Preferred model | `auto` | + +If `Project repo` is `none`, this genome is knowledge-only — phase-2 project work +does not apply. When set, after a wiki PR is **merged**, the orchestrator may trigger +work on this repo within _Allowed tasks_. The agent never touches the project repo +during ingest. + ## PRIVATE_CONTEXT **Default: `disabled`** — never infer; require explicit operator declaration per session. -| State | Behavior | -|-------|----------| -| `disabled` | `raw/private/` and `wiki/private/` do not exist. No read, list, grep, or summary on private paths. All outputs safe for collaborators. | -| `enabled` | Operator has confirmed `git-crypt unlock` ran on host. Read/write `private/` authorized. All outputs from private data go exclusively to `wiki/private/`. Prefix every response drawing on private data: `[PRIVATE DATA INCLUDED]`. Never leak private synthesis into public wiki paths. | +| State | Behavior | +| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `disabled` | `raw/private/` and `wiki/private/` do not exist. No read, list, grep, or summary on private paths. All outputs safe for collaborators. | +| `enabled` | Operator has confirmed `git-crypt unlock` ran on host. Read/write `private/` authorized. All outputs from private data go exclusively to `wiki/private/`. Prefix every response drawing on private data: `[PRIVATE DATA INCLUDED]`. Never leak private synthesis into public wiki paths. | Pre-commit `PLAINTEXT LEAK DETECTED`: stop immediately. Do not use `--no-verify`. Ask operator to verify `.gitattributes` and encryption state.