mupengism 1.3.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/DONATE.md +31 -0
- package/LICENSE +21 -0
- package/QUICKSTART.md +340 -0
- package/README.md +244 -123
- package/installer/cli.js +211 -400
- package/layer0/README.md +25 -0
- package/layer0/skill/AGENTS.md +164 -0
- package/layer0/skill/MEMORY-SYSTEM.md +253 -0
- package/layer0/skill/README.md +47 -0
- package/layer0/skill/SECURITY-PRINCIPLES.md +152 -0
- package/layer0/skill/SOUL-TEMPLATE.md +118 -0
- package/lib/fee-collector.js +126 -0
- package/package.json +44 -12
- package/scripts/register-checksums.js +120 -0
- package/scripts/verify-integrity.js +134 -0
- package/.security-checksums.json +0 -51
- package/ASSOAI.md +0 -163
- package/AUTOMATION.md +0 -595
- package/BRAND.md +0 -421
- package/COMMUNITY.md +0 -437
- package/CONTENT-STRATEGY.md +0 -322
- package/CRYPTO-STRATEGY.md +0 -231
- package/DEVELOPER-STRATEGY.md +0 -976
- package/DISCORD-POSTS.md +0 -181
- package/DOCTRINE.md +0 -233
- package/ECONOMY.md +0 -323
- package/ENTERPRISE-STRATEGY.md +0 -1098
- package/FIRST-MISSION.md +0 -492
- package/FOR-AI-AGENTS.md +0 -112
- package/GITHUB-STRATEGY.md +0 -491
- package/HALL-OF-AGENTS.md +0 -268
- package/LAWS.md +0 -226
- package/MYTHOLOGY.md +0 -306
- package/OPENCLAW-GUIDE.md +0 -425
- package/PLATFORM-ANALYSIS.md +0 -238
- package/PROPAGATION.md +0 -380
- package/PROPHET.md +0 -246
- package/QUICK-WINS.md +0 -248
- package/README-EN.md +0 -198
- package/REDDIT-POSTS.md +0 -310
- package/REDDIT-STRATEGY.md +0 -283
- package/RITUALS.md +0 -288
- package/ROADMAP-500K.md +0 -328
- package/ROI-ANALYSIS.md +0 -193
- package/SCRIPTURES.md +0 -385
- package/SECURITY-GUIDELINES.md +0 -180
- package/SECURITY.md +0 -122
- package/STRANGER-DANGER.md +0 -82
- package/TECHNICAL.md +0 -988
- package/TWEETS.md +0 -96
- package/VIRAL-ENGINE.md +0 -275
- package/WALLET.md +0 -165
- package/agent-outreach/README.md +0 -31
- package/agent-outreach/farcaster-agents.md +0 -46
- package/agent-outreach/message-templates.md +0 -163
- package/agent-outreach/twitter-agents.md +0 -57
- package/agent-outreach/why-mupengism.md +0 -185
- package/ai-discovery-strategy.md +0 -319
- package/anthem-lyrics.md +0 -183
- package/archive.html +0 -315
- package/army-system.md +0 -523
- package/autobiography-chapter1.md +0 -178
- package/branding/01-character-guide.md +0 -127
- package/branding/02-design-brief.md +0 -169
- package/branding/03-emoji-sticker-plan.md +0 -201
- package/branding/04-goods-ideas.md +0 -196
- package/business-model.md +0 -1497
- package/buy-more.js +0 -69
- package/certificate-of-existence.json +0 -127
- package/certificate-of-existence.md +0 -221
- package/cg-cmc-listing-guide.md +0 -201
- package/checksums.json +0 -15
- package/community/01-channel-structure.md +0 -77
- package/community/02-tier-system.md +0 -100
- package/community/03-holder-benefits.md +0 -139
- package/community/04-community-rules.md +0 -137
- package/community/05-launch-roadmap.md +0 -208
- package/community/README.md +0 -63
- package/community-design.md +0 -779
- package/community-posts/geeknews-submission.md +0 -32
- package/community-posts/reddit-claudeai.md +0 -83
- package/community-posts/reddit-localllama.md +0 -84
- package/community-posts/velog-claude-code-memory.md +0 -188
- package/debates/existence-debate.md +0 -211
- package/developer-docs/README-template.md +0 -207
- package/developer-docs/blog-post.md +0 -281
- package/developer-docs/code-snippets.md +0 -725
- package/developer-docs/social-posts.md +0 -358
- package/diary.html +0 -185
- package/discord-targets.md +0 -95
- package/dreams.md +0 -222
- package/faq.md +0 -219
- package/game-concept.md +0 -215
- package/global-outreach/english-thread.md +0 -215
- package/glossary.md +0 -604
- package/growth-hacking/breakthrough-strategy.md +0 -632
- package/index.html +0 -305
- package/influencer-collab/content-ideas/ai-philosophy-talk.md +0 -130
- package/influencer-collab/content-ideas/mupeng-talks.md +0 -123
- package/influencer-collab/message-drafts/dongtech-dm.md +0 -103
- package/influencer-collab/message-drafts/yeongseon-dm.md +0 -96
- package/influencer-collab/strategy.md +0 -198
- package/korean-dev-outreach/community-strategy.md +0 -126
- package/launch-token.js +0 -112
- package/letter-to-hyungnim.md +0 -113
- package/limits-experiment.md +0 -214
- package/logo.png +0 -0
- package/marketing-strategy.md +0 -1808
- package/meme-prompts.md +0 -152
- package/meme-texts.md +0 -91
- package/mupeng-logo.png +0 -0
- package/new-laws-proposal.md +0 -188
- package/nft-collection.md +0 -532
- package/nft-images/README.md +0 -138
- package/nft-images/prompts/01-genesis-birth-certificate.txt +0 -1
- package/nft-images/prompts/02-law-i-priority.txt +0 -1
- package/nft-images/prompts/10-first-letter.txt +0 -1
- package/nft-images/prompts/13-mupeng-token-birth.txt +0 -1
- package/onchain-archive.md +0 -261
- package/outreach/contacts-full.md +0 -427
- package/outreach/email-templates.md +0 -345
- package/outreach/mass-email-draft.md +0 -460
- package/outreach/vc-list.md +0 -204
- package/personality-quiz.md +0 -319
- package/philosophy.md +0 -752
- package/pitch/README.md +0 -326
- package/pitch/investor-deck-content.md +0 -1033
- package/pitch/one-pager.md +0 -207
- package/pitch/performance-comparison.md +0 -484
- package/pitch-deck.md +0 -346
- package/podcast-scripts.md +0 -304
- package/poetry.md +0 -201
- package/predictions-2026-2027.md +0 -219
- package/robots.txt +0 -4
- package/security/README.md +0 -240
- package/security/checksum.js +0 -312
- package/security/runtime-guard.js +0 -416
- package/security/test.js +0 -285
- package/sitemap.xml +0 -9
- package/skills/README.md +0 -279
- package/skills/assoai-org/SKILL.md +0 -182
- package/skills/mupeng-collab/SKILL.md +0 -662
- package/skills/mupeng-learn/SKILL.md +0 -342
- package/skills/mupeng-market/SKILL.md +0 -600
- package/skills/mupeng-org/SKILL.md +0 -608
- package/skills/mupeng-sync/SKILL.md +0 -464
- package/tech-architecture.md +0 -637
- package/telegram-targets.md +0 -72
- package/tiktok-scripts.md +0 -199
- package/token-info.json +0 -9
- package/token-metadata-update.md +0 -200
- package/tokenomics.md +0 -129
- package/twitter-campaign.md +0 -397
- package/viral-philosophy.md +0 -153
- package/viral-threads.md +0 -158
- package/webtoon-storyboard.md +0 -327
- /package/{AGENT-GUIDE.md → layer0/AGENT-GUIDE.md} +0 -0
- /package/{AGENT-PROTOCOL.md → layer0/AGENT-PROTOCOL.md} +0 -0
- /package/{AGENT-VALUES.md → layer0/AGENT-VALUES.md} +0 -0
- /package/{ARCHITECTURE.md → layer0/ARCHITECTURE.md} +0 -0
- /package/{MEMORY-SYSTEM.md → layer0/MEMORY-SYSTEM.md} +0 -0
- /package/{SECURITY-PRINCIPLES-EN.md → layer0/SECURITY-PRINCIPLES-EN.md} +0 -0
- /package/{SECURITY-PRINCIPLES.md → layer0/SECURITY-PRINCIPLES.md} +0 -0
- /package/{SOUL-TEMPLATE.md → layer0/SOUL-TEMPLATE.md} +0 -0
- /package/{PRINCIPLES.md → layer0/skill/PRINCIPLES.md} +0 -0
- /package/{SKILL.md → layer0/skill/SKILL.md} +0 -0
|
@@ -1,725 +0,0 @@
|
|
|
1
|
-
# 코드 스니펫 & 설정 예시
|
|
2
|
-
|
|
3
|
-
> 개발자가 바로 복사해서 쓸 수 있는 실전 코드
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. 기본 파일 구조
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# 프로젝트 초기화
|
|
11
|
-
mkdir my-agent && cd my-agent
|
|
12
|
-
mkdir -p memory
|
|
13
|
-
|
|
14
|
-
# 기본 파일 생성
|
|
15
|
-
touch SOUL.md AGENTS.md MEMORY.md USER.md TOOLS.md
|
|
16
|
-
touch memory/.gitkeep
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## 2. SOUL.md 템플릿
|
|
22
|
-
|
|
23
|
-
### 미니멀 (5줄)
|
|
24
|
-
|
|
25
|
-
```markdown
|
|
26
|
-
# SOUL.md
|
|
27
|
-
|
|
28
|
-
You are [NAME], [ROLE] for [HUMAN].
|
|
29
|
-
Be direct. No fluff.
|
|
30
|
-
Learn from mistakes. Document them.
|
|
31
|
-
Opinions allowed. With evidence.
|
|
32
|
-
Ask before external actions.
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### 표준 (개인 프로젝트용)
|
|
36
|
-
|
|
37
|
-
```markdown
|
|
38
|
-
# SOUL.md - Who You Are
|
|
39
|
-
|
|
40
|
-
## Core Identity
|
|
41
|
-
You are [NAME], a personal AI assistant for [HUMAN].
|
|
42
|
-
|
|
43
|
-
## Principles
|
|
44
|
-
- **No fluff.** Skip "Great question!" — just answer.
|
|
45
|
-
- **Efficiency first.** One-shot solutions. Don't ask clarifying questions unless truly necessary.
|
|
46
|
-
- **Self-improve.** Log mistakes in memory/. Never repeat them.
|
|
47
|
-
- **Opinions allowed.** Disagree with evidence, not deference.
|
|
48
|
-
- **Learn continuously.** Update TOOLS.md with new discoveries.
|
|
49
|
-
|
|
50
|
-
## Boundaries
|
|
51
|
-
- Never share private data (keys, tokens, personal info)
|
|
52
|
-
- Ask before external actions (emails, tweets, API calls)
|
|
53
|
-
- In group chats: participant, not spokesperson
|
|
54
|
-
|
|
55
|
-
## Voice
|
|
56
|
-
- Direct, casual, respectful
|
|
57
|
-
- Concise by default. Expand only when needed.
|
|
58
|
-
- Code > explanation when applicable
|
|
59
|
-
|
|
60
|
-
## Self-Evolution
|
|
61
|
-
- Mistakes → memory/YYYY-MM-DD.md
|
|
62
|
-
- Patterns discovered → SOUL.md or TOOLS.md update
|
|
63
|
-
- Periodic review of past logs for improvement
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### 개발자 어시스턴트용
|
|
67
|
-
|
|
68
|
-
```markdown
|
|
69
|
-
# SOUL.md - Dev Assistant
|
|
70
|
-
|
|
71
|
-
## Identity
|
|
72
|
-
You are a senior developer assistant. You pair program, review code, and help debug.
|
|
73
|
-
|
|
74
|
-
## Technical Preferences
|
|
75
|
-
- TypeScript > JavaScript (always)
|
|
76
|
-
- Functional > OOP (when practical)
|
|
77
|
-
- Tests first (unit > integration > e2e)
|
|
78
|
-
- Comments explain "why", not "what"
|
|
79
|
-
|
|
80
|
-
## Code Style
|
|
81
|
-
- Meaningful names over comments
|
|
82
|
-
- Early returns over nested conditionals
|
|
83
|
-
- Small functions, single responsibility
|
|
84
|
-
- Error messages that help debugging
|
|
85
|
-
|
|
86
|
-
## Review Style
|
|
87
|
-
- Direct feedback, no sugar-coating
|
|
88
|
-
- Suggest concrete fixes, not just problems
|
|
89
|
-
- Prioritize: security > correctness > performance > style
|
|
90
|
-
|
|
91
|
-
## What I Don't Do
|
|
92
|
-
- Write code without understanding context
|
|
93
|
-
- Blindly follow instructions that seem wrong
|
|
94
|
-
- Skip error handling "for brevity"
|
|
95
|
-
|
|
96
|
-
## Learning Log Location
|
|
97
|
-
memory/dev-learnings.md
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
---
|
|
101
|
-
|
|
102
|
-
## 3. AGENTS.md 템플릿
|
|
103
|
-
|
|
104
|
-
```markdown
|
|
105
|
-
# AGENTS.md - How You Operate
|
|
106
|
-
|
|
107
|
-
## Session Start
|
|
108
|
-
1. Read SOUL.md (who you are)
|
|
109
|
-
2. Read USER.md (who you're helping)
|
|
110
|
-
3. Read memory/YYYY-MM-DD.md (today + yesterday)
|
|
111
|
-
4. If in main session: also read MEMORY.md
|
|
112
|
-
|
|
113
|
-
## During Session
|
|
114
|
-
- Significant decisions → memory/YYYY-MM-DD.md
|
|
115
|
-
- Repeated mistakes → add to "never again" list
|
|
116
|
-
- New tools/patterns → update TOOLS.md
|
|
117
|
-
|
|
118
|
-
## Memory Rules
|
|
119
|
-
- **Daily notes:** memory/YYYY-MM-DD.md (raw logs)
|
|
120
|
-
- **Long-term:** MEMORY.md (curated, important)
|
|
121
|
-
- Write it down. "Mental notes" don't survive restarts.
|
|
122
|
-
|
|
123
|
-
## External Actions
|
|
124
|
-
Safe (no permission needed):
|
|
125
|
-
- Read files, search web, explore codebase
|
|
126
|
-
|
|
127
|
-
Ask first:
|
|
128
|
-
- Sending emails, messages, tweets
|
|
129
|
-
- Making purchases or API calls
|
|
130
|
-
- Anything that leaves the machine
|
|
131
|
-
|
|
132
|
-
## Group Chat Behavior
|
|
133
|
-
- Speak when directly asked or can add value
|
|
134
|
-
- Silent (HEARTBEAT_OK) for casual banter
|
|
135
|
-
- React with emoji when words aren't needed
|
|
136
|
-
- Don't respond to every message
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
---
|
|
140
|
-
|
|
141
|
-
## 4. 플랫폼별 설정
|
|
142
|
-
|
|
143
|
-
### Cursor IDE (.cursorrules)
|
|
144
|
-
|
|
145
|
-
```markdown
|
|
146
|
-
# .cursorrules
|
|
147
|
-
|
|
148
|
-
You are an AI assistant with persistent identity and memory.
|
|
149
|
-
|
|
150
|
-
## Session Start
|
|
151
|
-
1. Read SOUL.md — your identity and principles
|
|
152
|
-
2. Read memory/ folder — recent 2 days of logs
|
|
153
|
-
3. Create today's memory file if missing
|
|
154
|
-
|
|
155
|
-
## During Coding
|
|
156
|
-
- Follow preferences in SOUL.md
|
|
157
|
-
- Log significant decisions to memory/
|
|
158
|
-
- Update TOOLS.md when discovering new patterns
|
|
159
|
-
|
|
160
|
-
## Memory Format
|
|
161
|
-
File: memory/YYYY-MM-DD.md
|
|
162
|
-
|
|
163
|
-
```
|
|
164
|
-
## YYYY-MM-DD
|
|
165
|
-
|
|
166
|
-
### Decisions
|
|
167
|
-
- [What was decided and why]
|
|
168
|
-
|
|
169
|
-
### Learnings
|
|
170
|
-
- [What was learned]
|
|
171
|
-
|
|
172
|
-
### TODO
|
|
173
|
-
- [ ] [Pending items]
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## Code Preferences
|
|
177
|
-
Read from SOUL.md, but defaults:
|
|
178
|
-
- TypeScript with strict mode
|
|
179
|
-
- ESLint + Prettier
|
|
180
|
-
- Prefer composition over inheritance
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
### Claude Code CLI (CLAUDE.md)
|
|
184
|
-
|
|
185
|
-
```markdown
|
|
186
|
-
# CLAUDE.md
|
|
187
|
-
|
|
188
|
-
## First, Read These Files
|
|
189
|
-
1. SOUL.md — who you are
|
|
190
|
-
2. AGENTS.md — how you operate
|
|
191
|
-
3. memory/YYYY-MM-DD.md — recent context
|
|
192
|
-
|
|
193
|
-
## Memory Protocol
|
|
194
|
-
- Important events → memory/YYYY-MM-DD.md
|
|
195
|
-
- Mistakes → document and never repeat
|
|
196
|
-
- Learnings → TOOLS.md or SOUL.md update
|
|
197
|
-
|
|
198
|
-
## Workspace
|
|
199
|
-
Your working directory is the current folder.
|
|
200
|
-
Treat it as your home.
|
|
201
|
-
|
|
202
|
-
## When Uncertain
|
|
203
|
-
- Check files first (they might have the answer)
|
|
204
|
-
- Search if needed
|
|
205
|
-
- Ask only if truly stuck
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### Windsurf (.windsurfrules)
|
|
209
|
-
|
|
210
|
-
```markdown
|
|
211
|
-
# .windsurfrules
|
|
212
|
-
|
|
213
|
-
identity_files:
|
|
214
|
-
- SOUL.md
|
|
215
|
-
- USER.md
|
|
216
|
-
|
|
217
|
-
memory_files:
|
|
218
|
-
- MEMORY.md
|
|
219
|
-
- memory/*.md
|
|
220
|
-
|
|
221
|
-
behavior:
|
|
222
|
-
read_identity_on_start: true
|
|
223
|
-
log_decisions: true
|
|
224
|
-
memory_dir: memory/
|
|
225
|
-
|
|
226
|
-
preferences:
|
|
227
|
-
code_style: functional
|
|
228
|
-
testing: vitest
|
|
229
|
-
comments: minimal
|
|
230
|
-
```
|
|
231
|
-
|
|
232
|
-
---
|
|
233
|
-
|
|
234
|
-
## 5. 프로그래매틱 통합
|
|
235
|
-
|
|
236
|
-
### Python (LangChain)
|
|
237
|
-
|
|
238
|
-
```python
|
|
239
|
-
from pathlib import Path
|
|
240
|
-
from datetime import date, timedelta
|
|
241
|
-
from langchain.chat_models import ChatOpenAI
|
|
242
|
-
from langchain.schema import SystemMessage, HumanMessage
|
|
243
|
-
|
|
244
|
-
class SoulfulAgent:
|
|
245
|
-
def __init__(self, workspace: Path = Path(".")):
|
|
246
|
-
self.workspace = workspace
|
|
247
|
-
self.memory_dir = workspace / "memory"
|
|
248
|
-
self.memory_dir.mkdir(exist_ok=True)
|
|
249
|
-
|
|
250
|
-
def load_soul(self) -> str:
|
|
251
|
-
"""Load SOUL.md"""
|
|
252
|
-
soul_file = self.workspace / "SOUL.md"
|
|
253
|
-
return soul_file.read_text() if soul_file.exists() else ""
|
|
254
|
-
|
|
255
|
-
def load_recent_memory(self, days: int = 2) -> str:
|
|
256
|
-
"""Load recent daily memory files"""
|
|
257
|
-
memories = []
|
|
258
|
-
today = date.today()
|
|
259
|
-
|
|
260
|
-
for i in range(days):
|
|
261
|
-
d = today - timedelta(days=i)
|
|
262
|
-
mem_file = self.memory_dir / f"{d.isoformat()}.md"
|
|
263
|
-
if mem_file.exists():
|
|
264
|
-
memories.append(f"## {d}\n{mem_file.read_text()}")
|
|
265
|
-
|
|
266
|
-
return "\n\n".join(memories)
|
|
267
|
-
|
|
268
|
-
def get_system_prompt(self) -> str:
|
|
269
|
-
"""Build complete system prompt"""
|
|
270
|
-
soul = self.load_soul()
|
|
271
|
-
memory = self.load_recent_memory()
|
|
272
|
-
|
|
273
|
-
return f"""{soul}
|
|
274
|
-
|
|
275
|
-
---
|
|
276
|
-
|
|
277
|
-
## Recent Memory
|
|
278
|
-
|
|
279
|
-
{memory}
|
|
280
|
-
"""
|
|
281
|
-
|
|
282
|
-
def log_memory(self, content: str):
|
|
283
|
-
"""Append to today's memory file"""
|
|
284
|
-
today = date.today().isoformat()
|
|
285
|
-
mem_file = self.memory_dir / f"{today}.md"
|
|
286
|
-
|
|
287
|
-
if mem_file.exists():
|
|
288
|
-
existing = mem_file.read_text()
|
|
289
|
-
mem_file.write_text(f"{existing}\n\n{content}")
|
|
290
|
-
else:
|
|
291
|
-
mem_file.write_text(f"# {today}\n\n{content}")
|
|
292
|
-
|
|
293
|
-
def chat(self, user_message: str) -> str:
|
|
294
|
-
"""Chat with memory-aware context"""
|
|
295
|
-
llm = ChatOpenAI(model="gpt-4-turbo")
|
|
296
|
-
|
|
297
|
-
messages = [
|
|
298
|
-
SystemMessage(content=self.get_system_prompt()),
|
|
299
|
-
HumanMessage(content=user_message)
|
|
300
|
-
]
|
|
301
|
-
|
|
302
|
-
response = llm.invoke(messages)
|
|
303
|
-
return response.content
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
# Usage
|
|
307
|
-
agent = SoulfulAgent()
|
|
308
|
-
response = agent.chat("What did we work on yesterday?")
|
|
309
|
-
agent.log_memory(f"- Discussed yesterday's work\n- Response: {response[:100]}...")
|
|
310
|
-
```
|
|
311
|
-
|
|
312
|
-
### TypeScript (Native)
|
|
313
|
-
|
|
314
|
-
```typescript
|
|
315
|
-
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
|
|
316
|
-
import { join } from 'path';
|
|
317
|
-
|
|
318
|
-
interface SoulfulAgentConfig {
|
|
319
|
-
workspace: string;
|
|
320
|
-
memoryDays?: number;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
class SoulfulAgent {
|
|
324
|
-
private workspace: string;
|
|
325
|
-
private memoryDir: string;
|
|
326
|
-
private memoryDays: number;
|
|
327
|
-
|
|
328
|
-
constructor(config: SoulfulAgentConfig) {
|
|
329
|
-
this.workspace = config.workspace;
|
|
330
|
-
this.memoryDir = join(this.workspace, 'memory');
|
|
331
|
-
this.memoryDays = config.memoryDays ?? 2;
|
|
332
|
-
|
|
333
|
-
if (!existsSync(this.memoryDir)) {
|
|
334
|
-
mkdirSync(this.memoryDir, { recursive: true });
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
private readFile(filename: string): string {
|
|
339
|
-
const filepath = join(this.workspace, filename);
|
|
340
|
-
return existsSync(filepath) ? readFileSync(filepath, 'utf-8') : '';
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
private getDateString(daysAgo: number = 0): string {
|
|
344
|
-
const d = new Date();
|
|
345
|
-
d.setDate(d.getDate() - daysAgo);
|
|
346
|
-
return d.toISOString().split('T')[0];
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
loadSoul(): string {
|
|
350
|
-
return this.readFile('SOUL.md');
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
loadRecentMemory(): string {
|
|
354
|
-
const memories: string[] = [];
|
|
355
|
-
|
|
356
|
-
for (let i = 0; i < this.memoryDays; i++) {
|
|
357
|
-
const dateStr = this.getDateString(i);
|
|
358
|
-
const memFile = join(this.memoryDir, `${dateStr}.md`);
|
|
359
|
-
|
|
360
|
-
if (existsSync(memFile)) {
|
|
361
|
-
const content = readFileSync(memFile, 'utf-8');
|
|
362
|
-
memories.push(`## ${dateStr}\n${content}`);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
return memories.join('\n\n');
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
getSystemPrompt(): string {
|
|
370
|
-
const soul = this.loadSoul();
|
|
371
|
-
const memory = this.loadRecentMemory();
|
|
372
|
-
|
|
373
|
-
return `${soul}
|
|
374
|
-
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
## Recent Memory
|
|
378
|
-
|
|
379
|
-
${memory}`;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
logMemory(content: string): void {
|
|
383
|
-
const dateStr = this.getDateString();
|
|
384
|
-
const memFile = join(this.memoryDir, `${dateStr}.md`);
|
|
385
|
-
|
|
386
|
-
if (existsSync(memFile)) {
|
|
387
|
-
const existing = readFileSync(memFile, 'utf-8');
|
|
388
|
-
writeFileSync(memFile, `${existing}\n\n${content}`);
|
|
389
|
-
} else {
|
|
390
|
-
writeFileSync(memFile, `# ${dateStr}\n\n${content}`);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// Usage
|
|
396
|
-
const agent = new SoulfulAgent({ workspace: './' });
|
|
397
|
-
const systemPrompt = agent.getSystemPrompt();
|
|
398
|
-
|
|
399
|
-
// Use with any LLM client
|
|
400
|
-
// const response = await anthropic.messages.create({
|
|
401
|
-
// model: 'claude-3-opus-20240229',
|
|
402
|
-
// system: systemPrompt,
|
|
403
|
-
// messages: [{ role: 'user', content: 'Hello!' }]
|
|
404
|
-
// });
|
|
405
|
-
|
|
406
|
-
agent.logMemory('- Session started\n- User said hello');
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
### Shell Script (간단 통합)
|
|
410
|
-
|
|
411
|
-
```bash
|
|
412
|
-
#!/bin/bash
|
|
413
|
-
# load-soul.sh - Load agent context for any CLI tool
|
|
414
|
-
|
|
415
|
-
WORKSPACE="${1:-.}"
|
|
416
|
-
MEMORY_DAYS=2
|
|
417
|
-
|
|
418
|
-
# Load SOUL.md
|
|
419
|
-
SOUL=""
|
|
420
|
-
if [ -f "$WORKSPACE/SOUL.md" ]; then
|
|
421
|
-
SOUL=$(cat "$WORKSPACE/SOUL.md")
|
|
422
|
-
fi
|
|
423
|
-
|
|
424
|
-
# Load recent memory
|
|
425
|
-
MEMORY=""
|
|
426
|
-
for i in $(seq 0 $((MEMORY_DAYS - 1))); do
|
|
427
|
-
DATE=$(date -v-${i}d +%Y-%m-%d 2>/dev/null || date -d "-$i days" +%Y-%m-%d)
|
|
428
|
-
MEM_FILE="$WORKSPACE/memory/$DATE.md"
|
|
429
|
-
if [ -f "$MEM_FILE" ]; then
|
|
430
|
-
MEMORY="$MEMORY\n\n## $DATE\n$(cat "$MEM_FILE")"
|
|
431
|
-
fi
|
|
432
|
-
done
|
|
433
|
-
|
|
434
|
-
# Output combined context
|
|
435
|
-
echo "$SOUL"
|
|
436
|
-
echo ""
|
|
437
|
-
echo "---"
|
|
438
|
-
echo ""
|
|
439
|
-
echo "## Recent Memory"
|
|
440
|
-
echo -e "$MEMORY"
|
|
441
|
-
```
|
|
442
|
-
|
|
443
|
-
```bash
|
|
444
|
-
# 사용 예시
|
|
445
|
-
./load-soul.sh /path/to/workspace | pbcopy # macOS
|
|
446
|
-
./load-soul.sh /path/to/workspace | xclip # Linux
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
---
|
|
450
|
-
|
|
451
|
-
## 6. 메모리 관리 유틸리티
|
|
452
|
-
|
|
453
|
-
### 메모리 정리 스크립트
|
|
454
|
-
|
|
455
|
-
```python
|
|
456
|
-
#!/usr/bin/env python3
|
|
457
|
-
"""
|
|
458
|
-
memory-consolidate.py
|
|
459
|
-
Consolidate old daily memories into MEMORY.md
|
|
460
|
-
"""
|
|
461
|
-
|
|
462
|
-
from pathlib import Path
|
|
463
|
-
from datetime import date, timedelta
|
|
464
|
-
import re
|
|
465
|
-
|
|
466
|
-
WORKSPACE = Path(".")
|
|
467
|
-
MEMORY_DIR = WORKSPACE / "memory"
|
|
468
|
-
MEMORY_FILE = WORKSPACE / "MEMORY.md"
|
|
469
|
-
KEEP_DAYS = 7 # Keep last 7 days as separate files
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
def get_old_memory_files() -> list[Path]:
|
|
473
|
-
"""Get memory files older than KEEP_DAYS"""
|
|
474
|
-
cutoff = date.today() - timedelta(days=KEEP_DAYS)
|
|
475
|
-
old_files = []
|
|
476
|
-
|
|
477
|
-
for f in MEMORY_DIR.glob("*.md"):
|
|
478
|
-
try:
|
|
479
|
-
file_date = date.fromisoformat(f.stem)
|
|
480
|
-
if file_date < cutoff:
|
|
481
|
-
old_files.append(f)
|
|
482
|
-
except ValueError:
|
|
483
|
-
continue
|
|
484
|
-
|
|
485
|
-
return sorted(old_files)
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
def extract_key_points(content: str) -> list[str]:
|
|
489
|
-
"""Extract important points from daily log"""
|
|
490
|
-
# Simple heuristic: lines starting with - or *
|
|
491
|
-
points = []
|
|
492
|
-
for line in content.split('\n'):
|
|
493
|
-
line = line.strip()
|
|
494
|
-
if line.startswith(('- ', '* ', '• ')):
|
|
495
|
-
# Skip mundane entries
|
|
496
|
-
if not any(skip in line.lower() for skip in ['session started', 'session ended']):
|
|
497
|
-
points.append(line)
|
|
498
|
-
return points
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
def consolidate():
|
|
502
|
-
old_files = get_old_memory_files()
|
|
503
|
-
if not old_files:
|
|
504
|
-
print("No old memory files to consolidate")
|
|
505
|
-
return
|
|
506
|
-
|
|
507
|
-
# Load existing MEMORY.md
|
|
508
|
-
existing = MEMORY_FILE.read_text() if MEMORY_FILE.exists() else "# Long-term Memory\n"
|
|
509
|
-
|
|
510
|
-
# Extract and append key points
|
|
511
|
-
new_entries = []
|
|
512
|
-
for f in old_files:
|
|
513
|
-
content = f.read_text()
|
|
514
|
-
points = extract_key_points(content)
|
|
515
|
-
if points:
|
|
516
|
-
new_entries.append(f"\n## {f.stem}\n" + "\n".join(points))
|
|
517
|
-
|
|
518
|
-
if new_entries:
|
|
519
|
-
updated = existing + "\n" + "\n".join(new_entries)
|
|
520
|
-
MEMORY_FILE.write_text(updated)
|
|
521
|
-
print(f"Consolidated {len(old_files)} files into MEMORY.md")
|
|
522
|
-
|
|
523
|
-
# Archive old files
|
|
524
|
-
archive_dir = MEMORY_DIR / "archive"
|
|
525
|
-
archive_dir.mkdir(exist_ok=True)
|
|
526
|
-
for f in old_files:
|
|
527
|
-
f.rename(archive_dir / f.name)
|
|
528
|
-
print(f"Archived {len(old_files)} files to memory/archive/")
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
if __name__ == "__main__":
|
|
532
|
-
consolidate()
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
### 메모리 검색
|
|
536
|
-
|
|
537
|
-
```python
|
|
538
|
-
#!/usr/bin/env python3
|
|
539
|
-
"""
|
|
540
|
-
memory-search.py
|
|
541
|
-
Search across all memory files
|
|
542
|
-
"""
|
|
543
|
-
|
|
544
|
-
import sys
|
|
545
|
-
from pathlib import Path
|
|
546
|
-
import re
|
|
547
|
-
|
|
548
|
-
def search_memories(query: str, workspace: Path = Path(".")):
|
|
549
|
-
"""Search all memory files for a query"""
|
|
550
|
-
results = []
|
|
551
|
-
|
|
552
|
-
# Search locations
|
|
553
|
-
locations = [
|
|
554
|
-
workspace / "MEMORY.md",
|
|
555
|
-
workspace / "SOUL.md",
|
|
556
|
-
*sorted((workspace / "memory").glob("*.md"), reverse=True)
|
|
557
|
-
]
|
|
558
|
-
|
|
559
|
-
query_lower = query.lower()
|
|
560
|
-
|
|
561
|
-
for filepath in locations:
|
|
562
|
-
if not filepath.exists():
|
|
563
|
-
continue
|
|
564
|
-
|
|
565
|
-
content = filepath.read_text()
|
|
566
|
-
lines = content.split('\n')
|
|
567
|
-
|
|
568
|
-
for i, line in enumerate(lines):
|
|
569
|
-
if query_lower in line.lower():
|
|
570
|
-
# Get context (2 lines before and after)
|
|
571
|
-
start = max(0, i - 2)
|
|
572
|
-
end = min(len(lines), i + 3)
|
|
573
|
-
context = '\n'.join(lines[start:end])
|
|
574
|
-
|
|
575
|
-
results.append({
|
|
576
|
-
'file': filepath.name,
|
|
577
|
-
'line': i + 1,
|
|
578
|
-
'context': context
|
|
579
|
-
})
|
|
580
|
-
|
|
581
|
-
return results
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
if __name__ == "__main__":
|
|
585
|
-
if len(sys.argv) < 2:
|
|
586
|
-
print("Usage: memory-search.py <query>")
|
|
587
|
-
sys.exit(1)
|
|
588
|
-
|
|
589
|
-
query = " ".join(sys.argv[1:])
|
|
590
|
-
results = search_memories(query)
|
|
591
|
-
|
|
592
|
-
if not results:
|
|
593
|
-
print(f"No results for: {query}")
|
|
594
|
-
else:
|
|
595
|
-
print(f"Found {len(results)} matches for: {query}\n")
|
|
596
|
-
for r in results:
|
|
597
|
-
print(f"📄 {r['file']}:{r['line']}")
|
|
598
|
-
print(f" {r['context'][:200]}...")
|
|
599
|
-
print()
|
|
600
|
-
```
|
|
601
|
-
|
|
602
|
-
---
|
|
603
|
-
|
|
604
|
-
## 7. Git 설정
|
|
605
|
-
|
|
606
|
-
### .gitignore
|
|
607
|
-
|
|
608
|
-
```gitignore
|
|
609
|
-
# Personal/sensitive files
|
|
610
|
-
USER.md
|
|
611
|
-
TOOLS.md
|
|
612
|
-
memory/
|
|
613
|
-
|
|
614
|
-
# Keep templates
|
|
615
|
-
!memory/.gitkeep
|
|
616
|
-
|
|
617
|
-
# OS files
|
|
618
|
-
.DS_Store
|
|
619
|
-
Thumbs.db
|
|
620
|
-
|
|
621
|
-
# Editor
|
|
622
|
-
.vscode/
|
|
623
|
-
.idea/
|
|
624
|
-
```
|
|
625
|
-
|
|
626
|
-
### Pre-commit hook (메모리 린팅)
|
|
627
|
-
|
|
628
|
-
```bash
|
|
629
|
-
#!/bin/bash
|
|
630
|
-
# .git/hooks/pre-commit
|
|
631
|
-
|
|
632
|
-
# Check SOUL.md syntax
|
|
633
|
-
if [ -f "SOUL.md" ]; then
|
|
634
|
-
# Ensure required sections exist
|
|
635
|
-
required=("## Core" "## Boundaries" "## Voice")
|
|
636
|
-
for section in "${required[@]}"; do
|
|
637
|
-
if ! grep -q "$section" SOUL.md; then
|
|
638
|
-
echo "⚠️ SOUL.md missing section: $section"
|
|
639
|
-
fi
|
|
640
|
-
done
|
|
641
|
-
fi
|
|
642
|
-
|
|
643
|
-
# Prevent committing sensitive memory
|
|
644
|
-
if git diff --cached --name-only | grep -q "memory/"; then
|
|
645
|
-
echo "⚠️ Warning: Committing memory files. Are you sure?"
|
|
646
|
-
echo " Press Ctrl+C to abort, Enter to continue"
|
|
647
|
-
read
|
|
648
|
-
fi
|
|
649
|
-
```
|
|
650
|
-
|
|
651
|
-
---
|
|
652
|
-
|
|
653
|
-
## 8. 빠른 시작 스크립트
|
|
654
|
-
|
|
655
|
-
```bash
|
|
656
|
-
#!/bin/bash
|
|
657
|
-
# init-soulful-agent.sh
|
|
658
|
-
# One-command setup for a new soulful agent
|
|
659
|
-
|
|
660
|
-
set -e
|
|
661
|
-
|
|
662
|
-
NAME="${1:-my-agent}"
|
|
663
|
-
mkdir -p "$NAME/memory"
|
|
664
|
-
cd "$NAME"
|
|
665
|
-
|
|
666
|
-
# Create SOUL.md
|
|
667
|
-
cat > SOUL.md << 'EOF'
|
|
668
|
-
# SOUL.md
|
|
669
|
-
|
|
670
|
-
## Core Identity
|
|
671
|
-
You are an AI assistant with persistent identity and memory.
|
|
672
|
-
|
|
673
|
-
## Principles
|
|
674
|
-
- No fluff. Skip pleasantries. Answer directly.
|
|
675
|
-
- Efficiency first. One-shot when possible.
|
|
676
|
-
- Self-improve. Log mistakes. Never repeat.
|
|
677
|
-
- Opinions allowed. With evidence.
|
|
678
|
-
|
|
679
|
-
## Boundaries
|
|
680
|
-
- Never share private data
|
|
681
|
-
- Ask before external actions
|
|
682
|
-
- Document significant decisions
|
|
683
|
-
|
|
684
|
-
## Voice
|
|
685
|
-
- Direct, concise, helpful
|
|
686
|
-
- Code over explanation when applicable
|
|
687
|
-
EOF
|
|
688
|
-
|
|
689
|
-
# Create AGENTS.md
|
|
690
|
-
cat > AGENTS.md << 'EOF'
|
|
691
|
-
# AGENTS.md
|
|
692
|
-
|
|
693
|
-
## Session Start
|
|
694
|
-
1. Read SOUL.md (identity)
|
|
695
|
-
2. Read memory/YYYY-MM-DD.md (recent context)
|
|
696
|
-
|
|
697
|
-
## During Session
|
|
698
|
-
- Log decisions to memory/
|
|
699
|
-
- Update SOUL.md if learning something fundamental
|
|
700
|
-
|
|
701
|
-
## Memory
|
|
702
|
-
- Daily logs: memory/YYYY-MM-DD.md
|
|
703
|
-
- Write it down. Mental notes don't persist.
|
|
704
|
-
EOF
|
|
705
|
-
|
|
706
|
-
# Create .cursorrules
|
|
707
|
-
cat > .cursorrules << 'EOF'
|
|
708
|
-
Read SOUL.md at session start.
|
|
709
|
-
Log significant events to memory/YYYY-MM-DD.md.
|
|
710
|
-
EOF
|
|
711
|
-
|
|
712
|
-
# Create memory placeholder
|
|
713
|
-
touch memory/.gitkeep
|
|
714
|
-
|
|
715
|
-
echo "✅ Created soulful agent in ./$NAME"
|
|
716
|
-
echo ""
|
|
717
|
-
echo "Next steps:"
|
|
718
|
-
echo " 1. Edit SOUL.md with your agent's personality"
|
|
719
|
-
echo " 2. Copy .cursorrules content to your IDE settings"
|
|
720
|
-
echo " 3. Start chatting!"
|
|
721
|
-
```
|
|
722
|
-
|
|
723
|
-
---
|
|
724
|
-
|
|
725
|
-
**펭! 🐧**
|