Skip to content

Commit 37b54a7

Browse files
authored
feat: ✨add engram AI memory system (#4)
2 parents 7c97148 + 63e8287 commit 37b54a7

File tree

3 files changed

+90
-27
lines changed

3 files changed

+90
-27
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
**/.env*
22
**/.venv
33
**/venv
4+
.opencode
5+
**/*.log

Dockerfile

Lines changed: 87 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"]
55

66
USER root
77

8-
ENV DEBIAN_FRONTEND=noninteractive
8+
ENV DEBIAN_FRONTEND="noninteractive"
9+
ARG PYTHON_VERSION="3.12"
10+
ENV PYTHON_DIR="/usr/local/share/python/${PYTHON_VERSION}"
11+
ENV PATH="${PATH}:${PYTHON_DIR}/bin"
912

1013
# hadolint ignore=DL3008,DL3015,SC2116
1114
RUN <<'FOE'
1215

16+
ln -s /usr/local/bin/bun /usr/local/bin/node
17+
ls -s /usr/local/bin/bun /usr/local/bin/npx
18+
1319
apt-get update
1420
apt-get install \
1521
sudo \
1622
curl \
1723
git \
24+
jq \
1825
libatomic1 \
1926
-y
2027

@@ -50,6 +57,7 @@ curl https://mise.run | MISE_INSTALL_PATH=/usr/local/bin/mise sh
5057

5158
# Create the bash_profile.d directory and mise script
5259
mkdir /etc/bash_profile.d
60+
5361
cat >/etc/bash_profile.d/mise <<-'EOF'
5462
export PATH=/usr/local/bun/bin:$HOME/.local/bin:$PATH
5563
# Use appropriate mise activation based on shell type
@@ -62,25 +70,53 @@ else
6270
fi
6371
EOF
6472

65-
FOE
73+
mise install-into "python@${PYTHON_VERSION}" "${PYTHON_DIR}"
6674

67-
COPY --chmod=0555 entrypoint.sh /entrypoint.sh
75+
cat >/etc/bash_profile.d/python <<-'EOF'
76+
export PATH="${PATH}:${PYTHON_DIR}/bin"
77+
EOF
78+
79+
FOE
6880

6981
ARG OPENCODE_VERSION=latest
7082
ARG AZURE_FOUNDRY_PROVIDER_VERSION=0.2.0
71-
ARG ENGRAM_VERSION=v1.9.1
83+
ARG ENGRAM_VERSION=latest
7284

7385
ENV OPENCODE_CONFIG_DIR=/etc/opencode
7486
ENV OPENCODE_EXPERIMENTAL=1
7587
ENV ENGRAM_DATA_DIR=/home/bun/.local/share/opencode/engram
7688

89+
ENV AGENT_BROWSER_ENGINE=lightpanda
90+
91+
# hadolint ignore=DL3045
92+
COPY git-export.py git-export.py
93+
7794
# hadolint ignore=DL3003,SC2164
7895
RUN <<'FOE'
7996

8097
export BUN_INSTALL=/usr/local/bun
8198
export PROVIDER_DIR=/usr/local/provider
8299
export OPENCODE_PLUGINS_DIR="${OPENCODE_CONFIG_DIR}/plugins"
83100

101+
###
102+
# Helper function to resolve 'latest' to actual version tag from GitHub API
103+
# Usage: resolve_github_latest_version <owner>/<repo> <version>
104+
# Returns: actual version tag (resolves 'latest' via API, otherwise returns input as-is)
105+
#
106+
resolve_github_latest_version() {
107+
local repo_slug="${1}"
108+
local version="${2}"
109+
110+
if [ "${version}" = "latest" ]; then
111+
version=$(curl -fsSL "https://api.github.com/repos/${repo_slug}/releases/latest" | jq -r '.tag_name')
112+
if [ -z "${version}" ] || [ "${version}" = "null" ]; then
113+
echo "Failed to fetch latest release version for ${repo_slug} from GitHub API" >&2
114+
return 1
115+
fi
116+
fi
117+
echo "${version}"
118+
}
119+
84120
mkdir -p "${BUN_INSTALL}" "${OPENCODE_CONFIG_DIR}" "${OPENCODE_PLUGINS_DIR}" "${PROVIDER_DIR}"
85121
chmod 0777 "${OPENCODE_CONFIG_DIR}"
86122

@@ -89,36 +125,54 @@ bun install -g "opencode-ai@${OPENCODE_VERSION}" || exit 1
89125
###
90126
# providers
91127
#
92-
pushd /tmp
128+
(
129+
pushd /tmp \
130+
&& bun install "github:ophiosdev/azure-foundry-provider#v${AZURE_FOUNDRY_PROVIDER_VERSION}" \
131+
&& cd node_modules/azure-foundry-provider \
132+
&& bun build --outdir=dist src/index.ts \
133+
&& mv dist "${PROVIDER_DIR}/azure-foundry-provider" \
134+
&& rm -rf /tmp/* \
135+
&& popd
136+
) || exit 1
93137

94-
bun install "github:ophiosdev/azure-foundry-provider#v${AZURE_FOUNDRY_PROVIDER_VERSION}" || exit 1
95-
cd node_modules/azure-foundry-provider || exit 1
96-
bun build --outdir=dist src/index.ts || exit 1
97-
mv dist "${PROVIDER_DIR}/azure-foundry-provider"
98-
rm -rf /tmp/*
99-
100-
popd || exit 1
138+
###
139+
# agent browser
140+
(
141+
bun install -g --trust agent-browser \
142+
&& curl -fsSL -o /usr/local/bin/lightpanda 'https://github.com/lightpanda-io/browser/releases/download/nightly/lightpanda-x86_64-linux' \
143+
&& chmod a+x /usr/local/bin/lightpanda
144+
) || exit 1
101145

102-
engram_version="${ENGRAM_VERSION#v}"
146+
###
147+
# engram
148+
#
149+
engram_resolved_version=$(resolve_github_latest_version "Gentleman-Programming/engram" "${ENGRAM_VERSION}") || exit 1
150+
engram_version="${engram_resolved_version#v}"
103151
engram_archive="engram_${engram_version}_linux_amd64.tar.gz"
104-
engram_url="https://github.com/Gentleman-Programming/engram/releases/download/${ENGRAM_VERSION}/${engram_archive}"
105-
curl -fsSL "${engram_url}" | tar -C /usr/local/bin -xvzf - engram
106-
curl -fsSL 'https://raw.githubusercontent.com/Gentleman-Programming/engram/refs/tags/${ENGRAM_VERSION}/plugin/opencode/engram.ts' -o "${OPENCODE_PLUGINS_DIR}/engram.ts"
152+
engram_url="https://github.com/Gentleman-Programming/engram/releases/download/${engram_resolved_version}/${engram_archive}"
153+
(
154+
curl -fsSL "${engram_url}" | tar -C /usr/local/bin -xvzf - engram \
155+
&& curl -fsSL "https://raw.githubusercontent.com/Gentleman-Programming/engram/refs/tags/${engram_resolved_version}/plugin/opencode/engram.ts" -o "${OPENCODE_PLUGINS_DIR}/engram.ts"
156+
)
107157

158+
###
159+
# UV
160+
uv_resolved_version=$(resolve_github_latest_version "astral-sh/uv" "${UV_VERSION:-latest}") || exit 1
161+
uv_version="${uv_resolved_version#v}"
162+
uv_url="https://releases.astral.sh/github/uv/releases/download/${uv_version}/uv-x86_64-unknown-linux-gnu.tar.gz"
163+
curl -fsSL "${uv_url}" | tar -C /usr/local/bin -xvzf - --strip-components=1 --wildcards '*/uv*' || exit 1
108164

109-
rm -rf /root/.bun
165+
##
166+
# jcodemunch-mcp
167+
uv pip install --system jcodemunch-mcp || exit 1
110168

169+
###
170+
# cleanup
171+
rm -rf /root/.bun
111172
chown -Rh bun:bun "$(echo ~bun)"
112173

113174
FOE
114175

115-
USER bun:bun
116-
117-
RUN mise use -g --silent python@3.12.12 go@1.24 ripgrep uv
118-
119-
# hadolint ignore=DL3045
120-
COPY --chown=bun:bun git-export.py git-export.py
121-
122176
RUN <<'FOE'
123177
source /etc/bash.bashrc
124178

@@ -135,9 +189,10 @@ RUN <<'FOE'
135189
curl -L 'https://raw.githubusercontent.com/Hmbown/aleph/refs/heads/main/docs/prompts/aleph.md' -o "${skills_dir}/${skill_name}/SKILL.md"
136190

137191
skill_name="changelog"
138-
python git-export.py https://github.com/sickn33/antigravity-awesome-skills/skills/changelog-automation "${skills_dir}/${skill_name}" --force
192+
python git-export.py "https://github.com/sickn33/antigravity-awesome-skills/skills/changelog-automation" "${skills_dir}/${skill_name}" --force
139193

140-
uv pip install --system jcodemunch-mcp
194+
skill_name="agent-browser"
195+
python git-export.py "https://github.com/vercel-labs/agent-browser/tree/main/skills/${skill_name}" "${skills_dir}/${skill_name}" --force
141196

142197
rm -f git-export.py
143198

@@ -155,7 +210,7 @@ RUN <<'FOE'
155210
"mcp",
156211
"--tools=agent"
157212
],
158-
"enabled": false
213+
"enabled": true
159214
},
160215
"sequential-thinking": {
161216
"type": "local",
@@ -199,6 +254,11 @@ EOF
199254

200255
FOE
201256

257+
COPY --chmod=0555 entrypoint.sh /entrypoint.sh
258+
259+
USER bun:bun
260+
261+
RUN mise use -g --silent go@1.24 ripgrep
202262

203263
# Set BASH_ENV so non-interactive bash shells (spawned by OpenCode CLI) source /etc/bash.bashrc
204264
# This ensures mise activation and PATH are available in shell commands

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ OPENCODE_VERSION ?= latest
99

1010
build:
1111
docker build \
12+
--progress=plain \
1213
-t $(IMAGE_REF) \
1314
-f $(DOCKERFILE) \
1415
--build-arg OPENCODE_VERSION=$(OPENCODE_VERSION) \

0 commit comments

Comments
 (0)