Lukas Goldschmidt 1 日 前
コミット
5cb6f7eeb1
3 ファイル変更32 行追加3 行削除
  1. 28 0
      AGENTS.md
  2. 1 1
      killserver.sh
  3. 3 2
      run.sh

+ 28 - 0
AGENTS.md

@@ -0,0 +1,28 @@
+# news-mcp
+
+## Local Environment
+- Source the repo-local `.venv` first when it exists.
+- Prefer `./tests.sh` for offline verification and `./live_tests.sh` only for provider-backed smoke checks.
+- Use `./run.sh` to start the server locally; it resolves the repo root and prefers the local Uvicorn binary.
+
+## Repo Map
+- `news_mcp/mcp_server_fastmcp.py`: MCP tool surface, startup refresh, pruning, and HTTP health endpoints.
+- `news_mcp/jobs/poller.py`: feed refresh loop, clustering, enrichment, and cache writes.
+- `news_mcp/storage/sqlite_store.py`: SQLite schema, cluster/entity metadata, feed hashes, and prune state.
+- `news_mcp/dedup/cluster.py`: topic bucketing and the current fuzzy/embedding clustering path.
+- `news_mcp/enrichment/llm_enrich.py`: LLM extraction/summarization and blacklist filtering.
+- `news_mcp/trends_resolution.py` and `news_mcp/related_entities.py`: local Google Trends-based entity resolution and neighborhood lookup.
+- `news_mcp/config.py`: env-driven defaults and file paths.
+
+## Current Contracts
+- Clusters are the unit of truth, not raw articles.
+- `NEWS_DEFAULT_LOOKBACK_HOURS` controls read freshness only.
+- `NEWS_PRUNING_ENABLED`, `NEWS_RETENTION_DAYS`, and `NEWS_PRUNE_INTERVAL_HOURS` control physical deletion.
+- Entity aliasing is intentionally conservative; keep `config/entity_aliases.json` tight.
+- `include_articles=true` should keep responses compact and only return minimal article fields.
+
+## Editing Rules
+- Keep changes aligned with the docs in `README.md`, `PROJECT.md`, and `OUTLOOK.md`.
+- Prefer narrow fixes over contract changes unless the user explicitly asks to expand behavior.
+- Do not run destructive maintenance scripts without a dry run first.
+- If a change touches storage or pruning, verify it against a temp DB or isolated test fixture rather than the live database.

+ 1 - 1
killserver.sh

@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 set -euo pipefail
-PIDFILE=${PIDFILE:-server.pid}
+PIDFILE=${PIDFILE:-logs/server.pid}
 
 SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 

+ 3 - 2
run.sh

@@ -3,10 +3,11 @@ set -euo pipefail
 
 PORT=${PORT:-8506}
 APP_MODULE=${APP_MODULE:-news_mcp.mcp_server_fastmcp:app}
-LOGFILE=${LOGFILE:-uvicorn.log}
-PIDFILE=${PIDFILE:-server.pid}
+LOGFILE=${LOGFILE:-logs/uvicorn.log}
+PIDFILE=${PIDFILE:-logs/server.pid}
 
 mkdir -p "$(dirname "$LOGFILE")"
+mkdir -p "$(dirname "$PIDFILE")"
 
 if [ -f "$PIDFILE" ] && ps -p "$(cat "$PIDFILE" 2>/dev/null)" > /dev/null 2>&1; then
   echo "Server already running (PID $(cat "$PIDFILE"))"