Replit Agent commited on
Commit
c19e241
·
1 Parent(s): 5d42acf

feat: auto-load CLAUDE.md memory + redirect root to /server

Browse files

- CLAUDE.md (if present) is read at startup and embedded into
opencode.json instructions field — every new chat automatically
has full context without the user asking
- nginx: location = / now 302-redirects to /server so opening the
Space URL lands directly on the chat UI

Files changed (1) hide show
  1. entrypoint.sh +18 -0
entrypoint.sh CHANGED
@@ -62,6 +62,19 @@ if not os.environ.get('ANTHROPIC_API_KEY') and not os.environ.get('OPENAI_API_KE
62
  d['model'] = 'opencode/big-pickle'
63
  elif not d.get('model'):
64
  d['model'] = 'opencode/big-pickle'
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  json.dump(d, open(p, 'w'), indent=2)
66
  print('[CONFIG] Wrote config with model:', d.get('model'))
67
  " 2>/dev/null || true
@@ -97,6 +110,11 @@ http {
97
  server {
98
  listen 7860;
99
 
 
 
 
 
 
100
  # Terminal (ttyd PTY)
101
  location /terminal {
102
  proxy_pass http://127.0.0.1:7681;
 
62
  d['model'] = 'opencode/big-pickle'
63
  elif not d.get('model'):
64
  d['model'] = 'opencode/big-pickle'
65
+ # Auto-load CLAUDE.md as persistent memory injected into every chat
66
+ claude_md = '/projects/default/CLAUDE.md'
67
+ try:
68
+ with open(claude_md) as f:
69
+ mem = f.read().strip()
70
+ if mem:
71
+ d['instructions'] = 'The following is your persistent memory (CLAUDE.md). Incorporate it automatically at the start of every conversation without being asked:\n\n' + mem
72
+ print('[CONFIG] CLAUDE.md loaded into instructions (' + str(len(mem)) + ' chars)')
73
+ else:
74
+ d.pop('instructions', None)
75
+ except FileNotFoundError:
76
+ d.pop('instructions', None)
77
+ print('[CONFIG] No CLAUDE.md yet — create /projects/default/CLAUDE.md for persistent memory')
78
  json.dump(d, open(p, 'w'), indent=2)
79
  print('[CONFIG] Wrote config with model:', d.get('model'))
80
  " 2>/dev/null || true
 
110
  server {
111
  listen 7860;
112
 
113
+ # Redirect bare root to the chat UI
114
+ location = / {
115
+ return 302 /server;
116
+ }
117
+
118
  # Terminal (ttyd PTY)
119
  location /terminal {
120
  proxy_pass http://127.0.0.1:7681;