{# SETTINGS · Workspace (project canonical-folder config). The IN-APP version of the repo_root fix previously done by CLI: lists every active project with its current canonical working folder (repo_root) + an edit field to CHANGE it. On save the row POSTs /settings/projects/{key}/folder, which PATCHes Cortex (admin-token-gated, backend-only) and re-renders THIS whole body so the listed folder reflects the change. The admin token is sourced server-side (env first, then local-cortex/.env) and is NEVER sent to the browser; when it can't be sourced the save is disabled with a clear banner. Context: selected_key : current project key (kept on swap URLs) pf_rows : [{key, name, repo_root}] active projects pf_count : number of projects pf_token_configured : bool — is an admin token available? (drives the banner) pf_saved_key : project just saved (POST only) — flags the row pf_saved_prev : previous repo_root (POST only) — for previous → new pf_saved_new : new repo_root (POST only) pf_save_error : error string (POST only) — inline error banner #}
Workspace folders
Each project's canonical working folder (repo_root) — the in-app version of changing it by CLI. This is the folder the project's workspace + all agent worktrees + harness/temp files live under. Editing it PATCHes Cortex with the admin token (kept server-side, never sent to the browser).
{% if not pf_token_configured %} {# Admin token couldn't be sourced (env nor .env) — saves are disabled. #}
Admin token not configured. Set CORTEX_ADMIN_TOKEN in the environment or in local-cortex/.env to edit project folders here. The current folders below are still shown read-only.
{% endif %} {% if pf_save_error %}
Couldn't change {{ pf_saved_key }}: {{ pf_save_error }}
{% elif pf_saved_key and pf_saved_new %}
Updated {{ pf_saved_key }} · {{ pf_saved_prev or "—" }} {{ pf_saved_new }}
{% endif %}
Projects {{ pf_count }} active · canonical repo_root
{% if pf_rows %}
    {% for r in pf_rows %}
  • {{ r.name }} {{ r.key }}
  • {% endfor %}
{% else %}

No active projects returned by Cortex.

{% endif %}

Changing a project's repo_root re-points its workspace + every agent worktree + harness/temp files to the new folder. The path must be absolute. Read-only Cortex surfaces are untouched — this is the single admin-authed write the console makes.