fix: normalize vault path case and permissions, remove DS-specific key references

- Fix Vault→vault fallback in wiki_continuous_ingest.py, bulk_wiki_ingest.py,
  backfill_decay_metadata.py (bug #1: path mismatch with setup.sh)
- Add chmod 755 on wiki/ and fabric/ after mkdir in Phase 6 (bug #2:
  600 permissions prevent Docker worker read access)
- Simplify API key detection: use OPENROUTER_API_KEY only, remove
  DS-specific fallback in key detection and .env writing
- Keep hooks.py fallback (tries generic first, then DS-specific) —
  correct for backward compatibility
This commit is contained in:
ClaudioDrews
2026-06-07 12:59:04 -03:00
parent a25f3a95d6
commit 57912f52d1
4 changed files with 13 additions and 13 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ COLLECTION = "knowledge_base"
BATCH_SIZE = 200
SCROLL_LIMIT = 200
LOG_FILE = Path.home() / ".hermes/logs/decay_scanner.log"
VAULT_ROOT = Path(os.environ.get("VAULT_PATH", str(Path.home() / "Vault")))
VAULT_ROOT = Path(os.environ.get("VAULT_PATH", str(Path.home() / "vault")))
# ─── Heuristics ──────────────────────────────────────────────────────────────
CONFIDENCE_BY_SOURCE = {
+1 -1
View File
@@ -29,7 +29,7 @@ except ImportError:
OPENROUTER_KEY = os.environ.get("OPENROUTER_API_KEY")
QDRANT_URL = "http://localhost:6333"
COLLECTION = "knowledge_base"
WIKI_ROOT = Path(os.environ.get("WIKI_ROOT", str(Path.home() / "Vault" / "wiki")))
WIKI_ROOT = Path(os.environ.get("WIKI_ROOT", str(Path.home() / "vault" / "wiki")))
EMBEDDING_MODEL = os.environ.get("EMBEDDING_MODEL", "qwen/qwen3-embedding-8b")
EMBEDDING_DIMS = 4096
MAX_TEXT_LEN = 8000 # truncate text for embedding (model context limit)
+1 -1
View File
@@ -22,7 +22,7 @@ ENV_PATH = Path.home() / "ai-stack" / "cognitive-agent" / ".env"
if ENV_PATH.exists():
load_dotenv(ENV_PATH)
WIKI_ROOT = Path(os.environ.get("WIKI_ROOT", str(Path.home() / "Vault" / "wiki")))
WIKI_ROOT = Path(os.environ.get("WIKI_ROOT", str(Path.home() / "vault" / "wiki")))
STATE_FILE = Path.home() / ".hermes" / "wiki_ingest_state.json"
FAILURES_FILE = Path.home() / ".hermes" / "wiki_ingest_failures.json"
REDIS_PASSWORD = os.environ.get("REDIS_PASSWORD", "")
+10 -10
View File
@@ -189,7 +189,11 @@ banner "Phase 6: Wiki & Vault"
mkdir -p "${VAULT_PATH}/wiki/"{raw,concepts,entities,comparisons,_meta,_archive}
mkdir -p "${VAULT_PATH}/fabric"
# Ensure Docker worker can read wiki files (umask may create 600)
chmod -R 755 "${VAULT_PATH}/wiki"
chmod -R 755 "${VAULT_PATH}/fabric"
ok "Directory structure created at ${VAULT_PATH}"
info "Permissions set to 755 on wiki/ and fabric/ (ensures Docker worker read access)"
# ──────────────────────────────────────────────────────────────────────────────
# Phase 7: Docker Stack
@@ -205,22 +209,18 @@ fi
cd "${DOCKER_DIR}"
# Detect OpenRouter API key from Hermes .env
# Detect API key from Hermes .env
OPENROUTER_KEY=""
if [ -f "${ENV_FILE}" ]; then
# Try OPENROUTER_DS_API_KEY first (Hermes default), then OPENROUTER_API_KEY
OPENROUTER_KEY=$(grep -oP 'OPENROUTER_DS_API_KEY=\K.*' "${ENV_FILE}" 2>/dev/null | head -1 || true)
if [ -z "${OPENROUTER_KEY}" ]; then
OPENROUTER_KEY=$(grep -oP 'OPENROUTER_API_KEY=\K.*' "${ENV_FILE}" 2>/dev/null | head -1 || true)
fi
OPENROUTER_KEY=$(grep -oP 'OPENROUTER_API_KEY=\K.*' "${ENV_FILE}" 2>/dev/null | head -1 || true)
fi
if [ -z "${OPENROUTER_KEY}" ]; then
echo ""
echo -e " ${YELLOW}Could not find your OpenRouter key in Hermes .env.${NC}"
echo " The worker needs it to generate embeddings."
echo -e " ${YELLOW}Could not find an API key in Hermes .env.${NC}"
echo " The worker needs an embedding-capable API key (OpenRouter or compatible)."
echo ""
read -r -p " Paste your OpenRouter key (e.g. sk-or-v1-...): " OPENROUTER_KEY
read -r -p " Paste your API key (e.g. sk-or-v1-...): " OPENROUTER_KEY
echo ""
fi
@@ -304,7 +304,7 @@ add_env "ICARUS_EXTRACTION_MODEL" "deepseek/deepseek-v4-flash"
add_env "EMBEDDING_DIMS" "4096"
add_env "HERMES_AGENT_NAME" "hermes"
add_env "REDIS_PASSWORD" "${REDIS_PW}"
add_env "OPENROUTER_DS_API_KEY" "${OPENROUTER_KEY}"
add_env "OPENROUTER_API_KEY" "${OPENROUTER_KEY}"
ok "Environment variables added to Hermes .env"