Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions ct/hindsight.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#!/usr/bin/env bash
_CS_DEFAULT_URL="https://raw.githubusercontent.com/community-scripts/DevScripts/main"
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")

# Copyright (c) 2021-2026 community-scripts ORG
# Author: andy-vdg
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
# Source: https://hindsight.vectorize.io/

APP="Hindsight"
var_tags="${var_tags:-ai;memory;mcp}"
var_cpu="${var_cpu:-2}"
var_ram="${var_ram:-2048}"
var_disk="${var_disk:-12}"
var_os="${var_os:-debian}"
var_version="${var_version:-13}"
#var_arm64="${var_arm64:-no}" # unset = ask the user; set yes/no only when verified
var_unprivileged="${var_unprivileged:-1}"

export var_llm_provider="${var_llm_provider:-}"
export var_llm_api_key="${var_llm_api_key:-}"
export var_llm_model="${var_llm_model:-}"
export var_llm_base_url="${var_llm_base_url:-}"

header_info "$APP"
variables
color
catch_errors

function update_script() {
header_info
check_container_storage
check_container_resources

if [[ ! -d /opt/hindsight ]]; then
msg_error "No Hindsight Installation Found!"
exit
fi

if check_for_gh_release "hindsight" "vectorize-io/hindsight"; then
msg_info "Stopping Hindsight"
systemctl stop hindsight
msg_ok "Stopped Hindsight"

CLEAN_INSTALL=1 fetch_and_deploy_gh_release "hindsight" "vectorize-io/hindsight" "tarball"
PYTHON_VERSION="3.11" UV_PROJECT_DIR="/opt/hindsight" setup_uv

msg_info "Updating Python Environment"
cd /opt/hindsight
$STD uv sync --locked --package hindsight-api-slim --extra local-ml
msg_ok "Updated Python Environment"

msg_info "Starting Hindsight"
systemctl start hindsight
msg_ok "Started Hindsight"
msg_ok "Updated successfully!"
fi
exit
}

start
build_container
description

msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW}Access the API and its interactive docs using the following URL:${CL}"
echo -e "${GATEWAY}${BGN}http://${IP}:8888/docs${CL}"
echo -e "${INFO}${YW}API key: ~/hindsight.creds (inside the container)${CL}"
87 changes: 87 additions & 0 deletions install/hindsight-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#!/usr/bin/env bash

# Copyright (c) 2021-2026 community-scripts ORG
# Author: andy-vdg
# License: MIT | https://github.com/community-scripts/DevScripts/raw/main/LICENSE
# Source: https://hindsight.vectorize.io/

source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os

PG_VERSION="18" PG_MODULES="pgvector" setup_postgresql
PG_DB_NAME="hindsight" PG_DB_USER="hindsight" PG_DB_EXTENSIONS="vector,pg_trgm,btree_gin" setup_postgresql_db
fetch_and_deploy_gh_release "hindsight" "vectorize-io/hindsight" "tarball"
PYTHON_VERSION="3.11" UV_PROJECT_DIR="/opt/hindsight" setup_uv

msg_info "Setting up Python Environment"
cd /opt/hindsight
$STD uv sync --locked --package hindsight-api-slim --extra local-ml
msg_ok "Set up Python Environment"

msg_info "Downloading Embedding and Reranker Models"
mkdir -p /opt/hindsight_data
HOME=/opt/hindsight_data $STD /opt/hindsight/.venv/bin/python -c "from sentence_transformers import SentenceTransformer, CrossEncoder; SentenceTransformer('BAAI/bge-small-en-v1.5'); CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')"
msg_ok "Downloaded Embedding and Reranker Models"

msg_info "Configuring Hindsight"
API_KEY=$(random_password 48)
cat <<EOF >/opt/hindsight.env
HINDSIGHT_API_HOST=0.0.0.0
HINDSIGHT_API_PORT=8888
HINDSIGHT_API_DATABASE_URL=postgresql://${PG_DB_USER}:${PG_DB_PASS}@127.0.0.1:5432/${PG_DB_NAME}
HINDSIGHT_API_TENANT_EXTENSION=hindsight_api.extensions.builtin.tenant:ApiKeyTenantExtension
HINDSIGHT_API_TENANT_API_KEY=${API_KEY}
HINDSIGHT_API_LLM_PROVIDER=${var_llm_provider:-none}
HINDSIGHT_API_LLM_API_KEY=${var_llm_api_key:-}
HINDSIGHT_API_LLM_MODEL=${var_llm_model:-}
HINDSIGHT_API_LLM_BASE_URL=${var_llm_base_url:-}
TRANSFORMERS_VERBOSITY=error
HF_HUB_VERBOSITY=error
TOKENIZERS_PARALLELISM=false
EOF
sed -i '/=$/d' /opt/hindsight.env
chmod 600 /opt/hindsight.env
cat <<EOF >>~/hindsight.creds

Hindsight API Key: ${API_KEY}
EOF
chmod 600 ~/hindsight.creds
msg_ok "Configured Hindsight"

msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/hindsight.service
[Unit]
Description=Hindsight API
Wants=network-online.target
After=network-online.target postgresql.service
Requires=postgresql.service

[Service]
Type=simple
User=root
WorkingDirectory=/opt/hindsight_data
Environment=HOME=/opt/hindsight_data
Environment=PYTHONUNBUFFERED=1
EnvironmentFile=/opt/hindsight.env
ExecStart=/opt/hindsight/.venv/bin/hindsight-api
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now hindsight
msg_ok "Created Service"

if [[ -z "${var_llm_provider:-}" ]]; then
msg_warn "No LLM configured: Hindsight stores plain chunks only. Set HINDSIGHT_API_LLM_PROVIDER and its key in /opt/hindsight.env, then run systemctl restart hindsight"
fi

motd_ssh
customize
cleanup_lxc
72 changes: 72 additions & 0 deletions json/hindsight.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
{
"name": "Hindsight",
"slug": "hindsight",
"categories": [
20
],
"date_created": "2026-10-31",
"type": "ct",
"updateable": true,
"privileged": false,
"interface_port": 8888,
"documentation": "https://hindsight.vectorize.io/developer/installation",
"website": "https://hindsight.vectorize.io/",
"repository": "https://github.com/vectorize-io/hindsight",
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons@main/webp/hindsight.webp",
"description": "Hindsight is an open-source memory server for AI agents. Agents retain conversations and documents into memory banks, then recall facts, entities and their history, or reflect on them, through a REST API, SDKs and an MCP server.",
"install_methods": [
{
"type": "default",
"script": "ct/hindsight.sh",
"config_path": "/opt/hindsight.env",
"resources": {
"cpu": 2,
"ram": 2048,
"hdd": 12,
"os": "Debian",
"version": "13"
}
}
],
"default_credentials": {
"username": null,
"password": null
},
"app_vars": [
{
"name": "var_llm_provider",
"label": "LLM Provider",
"type": "text",
"help": "Empty for none: memories are stored as plain chunks, without fact extraction or reflect. Otherwise openai, anthropic, gemini, groq, ollama, lmstudio and others; see https://hindsight.vectorize.io/developer/models"
},
{
"name": "var_llm_api_key",
"label": "LLM API Key",
"type": "password",
"secret": true,
"help": "Not needed for ollama or lmstudio"
},
{
"name": "var_llm_model",
"label": "LLM Model",
"type": "text",
"help": "Empty for the provider's default model"
},
{
"name": "var_llm_base_url",
"label": "LLM Base URL",
"type": "text",
"help": "Empty for the provider's default. For a local LLM, e.g. the Ollama script's container: http://<ollama-ip>:11434/v1"
}
],
"notes": [
{
"text": "The API key is saved to `~/hindsight.creds` inside the container. Send it as `Authorization: Bearer <key>` to the API and the MCP endpoint.",
"type": "info"
},
{
"text": "Without an LLM, Hindsight stores plain chunks only. Set the provider, key and model in `/opt/hindsight.env`, then run `systemctl restart hindsight`.",
"type": "info"
}
]
}
Loading