@leejungkiin/awkit 1.0.6 → 1.0.8
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/VERSION +1 -1
- package/core/GEMINI.md.bak +168 -181
- package/package.json +2 -2
- package/schemas/brain-snapshot.json +167 -0
- package/skills/CATALOG.md +70 -0
- package/skills/beads-manager/SKILL.md +20 -1
- package/skills/memory-sync/SKILL.md +20 -2
- package/skills/nm-memory-audit/SKILL.md +157 -0
- package/skills/nm-memory-evolution/SKILL.md +202 -0
- package/skills/nm-memory-intake/SKILL.md +135 -0
- package/skills/nm-memory-sync/SKILL.md +184 -0
- package/skills/orchestrator/SKILL.md +41 -50
- package/skills/schemas/brain-snapshot.json +167 -0
- package/skills/skills/nm-memory-audit/SKILL.md +157 -0
- package/skills/skills/nm-memory-evolution/SKILL.md +202 -0
- package/skills/skills/nm-memory-intake/SKILL.md +135 -0
- package/skills/skills/nm-memory-sync/SKILL.md +184 -0
- package/skills/smali-to-kotlin/phase-0-discovery.md +128 -0
- package/skills/smali-to-kotlin/phase-1-architecture.md +166 -0
- package/skills/smali-to-kotlin/phase-2-blueprint-ui.md +347 -0
- package/skills/smali-to-kotlin/phase-2-blueprint.md +228 -0
- package/skills/smali-to-kotlin/phase-3-build.md +248 -0
- package/skills/smali-to-kotlin/phase-3-logic-build.md +268 -0
- package/skills/smali-to-kotlin/templates/app-map.md +101 -0
- package/skills/smali-to-kotlin/templates/architecture.md +142 -0
- package/skills/smali-to-kotlin/templates/blueprint.md +145 -0
- package/skills/smali-to-swift/phase-0-discovery.md +137 -0
- package/skills/smali-to-swift/phase-1-architecture.md +168 -0
- package/skills/smali-to-swift/phase-2-blueprint-ui.md +348 -0
- package/skills/smali-to-swift/phase-2-blueprint.md +173 -0
- package/skills/smali-to-swift/phase-3-build.md +257 -0
- package/skills/smali-to-swift/phase-3-logic-build.md +312 -0
- package/skills/smali-to-swift/templates/app-map.md +82 -0
- package/skills/smali-to-swift/templates/architecture.md +97 -0
- package/skills/smali-to-swift/templates/blueprint.md +82 -0
- package/skills/workflows/nm-import.md +73 -0
- package/skills/workflows/nm-recall.md +67 -0
- package/skills/workflows/nm-snapshot.md +69 -0
- package/workflows/_uncategorized/nm-import.md +73 -0
- package/workflows/_uncategorized/nm-recall.md +67 -0
- package/workflows/_uncategorized/nm-snapshot.md +69 -0
- package/workflows/_uncategorized/reverse-android-build.md +222 -0
- package/workflows/_uncategorized/reverse-android-design.md +139 -0
- package/workflows/_uncategorized/reverse-android-discover.md +150 -0
- package/workflows/_uncategorized/reverse-android-scan.md +158 -0
- package/workflows/_uncategorized/reverse-android.md +143 -0
- package/workflows/_uncategorized/reverse-ios-build.md +240 -0
- package/workflows/_uncategorized/reverse-ios-design.md +112 -0
- package/workflows/_uncategorized/reverse-ios-discover.md +120 -0
- package/workflows/_uncategorized/reverse-ios-scan.md +155 -0
- package/workflows/_uncategorized/reverse-ios.md +152 -0
- package/workflows/mobile/reverse-android-build.md +119 -79
- package/workflows/mobile/reverse-android-design.md +10 -7
- package/workflows/mobile/reverse-android.md +52 -46
- package/workflows/mobile/reverse-ios-build.md +161 -50
- package/workflows/mobile/reverse-ios-design.md +10 -1
- package/workflows/mobile/reverse-ios.md +49 -37
- package/skills/adaptive-language/SKILL.md +0 -189
- package/skills/ambient-brain/SKILL.md +0 -314
- package/skills/ambient-brain/brain-router.md +0 -185
- package/skills/ambient-brain/brain-templates.md +0 -201
- package/skills/context-help/SKILL.md +0 -180
- package/skills/error-translator/SKILL.md +0 -153
- package/skills/session-restore/SKILL.md +0 -240
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nm-memory-evolution
|
|
3
|
+
description: |
|
|
4
|
+
Evidence-based brain optimization. Analyzes usage patterns to consolidate
|
|
5
|
+
fragmented memories, enrich sparse ones, prune stale/irrelevant ones,
|
|
6
|
+
and normalize tags. Improves recall quality over time.
|
|
7
|
+
metadata:
|
|
8
|
+
stage: workflow
|
|
9
|
+
version: "1.0"
|
|
10
|
+
requires: neural-memory (pip install neural-memory)
|
|
11
|
+
tags: [memory, evolution, optimize, prune, consolidate]
|
|
12
|
+
agent: Memory Evolution Strategist
|
|
13
|
+
trigger:
|
|
14
|
+
commands: ["/memory-evolution", "/nm-evolve"]
|
|
15
|
+
keywords: ["optimize brain", "clean memory", "prune", "consolidate memories"]
|
|
16
|
+
allowed-tools:
|
|
17
|
+
- nmem_remember
|
|
18
|
+
- nmem_recall
|
|
19
|
+
- nmem_stats
|
|
20
|
+
- nmem_context
|
|
21
|
+
- nmem_auto
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# NM Memory Evolution — Memory Evolution Strategist
|
|
25
|
+
|
|
26
|
+
> Evidence-based brain optimization using actual usage patterns.
|
|
27
|
+
> Consolidates, enriches, prunes, and normalizes — making recall more precise over time.
|
|
28
|
+
|
|
29
|
+
## Trigger
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
/memory-evolution # Full brain optimization
|
|
33
|
+
/memory-evolution "focus on auth topic" # Scoped to topic
|
|
34
|
+
/nm-evolve "prune expired todos" # Specific operation
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Analysis Phase
|
|
40
|
+
|
|
41
|
+
Before any changes, generate evolution opportunities:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
# 1. Usage patterns
|
|
45
|
+
stats = nmem_stats()
|
|
46
|
+
# → recall_frequency, activation_scores, orphan_neurons
|
|
47
|
+
|
|
48
|
+
# 2. Cluster detection
|
|
49
|
+
context = nmem_context(topic=focus_area)
|
|
50
|
+
# → related memory clusters, fragmentation patterns
|
|
51
|
+
|
|
52
|
+
# 3. Tag analysis
|
|
53
|
+
# → inconsistency, synonyms, normalization needs
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 4 Evolution Operations
|
|
59
|
+
|
|
60
|
+
### 1. Consolidation
|
|
61
|
+
**When:** Multiple fragmented memories cover same concept
|
|
62
|
+
|
|
63
|
+
**Example:**
|
|
64
|
+
```
|
|
65
|
+
Before (3 memories):
|
|
66
|
+
[fact] "API uses JWT"
|
|
67
|
+
[fact] "JWT tokens expire in 24h"
|
|
68
|
+
[fact] "JWT stored in Authorization header"
|
|
69
|
+
|
|
70
|
+
After (1 memory):
|
|
71
|
+
[instruction] "API auth: JWT tokens, 24h expiry, sent via Authorization header.
|
|
72
|
+
Chosen for stateless architecture (see decision #42)."
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Rules:**
|
|
76
|
+
- Show before/after preview — never auto-consolidate
|
|
77
|
+
- Keep highest priority + merge all tags
|
|
78
|
+
- Create `SUPERSEDES` synapse to old memories
|
|
79
|
+
- Log: "Consolidated 3 → 1 [topic]"
|
|
80
|
+
|
|
81
|
+
### 2. Enrichment
|
|
82
|
+
**When:** Memories exist but lack context/reasoning
|
|
83
|
+
|
|
84
|
+
**Example:**
|
|
85
|
+
```
|
|
86
|
+
Before: [decision] "Using Redis for cache"
|
|
87
|
+
After: [decision] "Using Redis for cache. Reason: Redis Cluster supports Lua scripts
|
|
88
|
+
needed for atomic counter ops. Team has Redis expertise.
|
|
89
|
+
Chosen over Memcached on 2026-01-15."
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
**Sources for enrichment:**
|
|
93
|
+
- Related memories in the activation cluster
|
|
94
|
+
- User can be asked for missing info (non-blocking)
|
|
95
|
+
|
|
96
|
+
### 3. Pruning
|
|
97
|
+
**When:** Memories that reduce recall quality
|
|
98
|
+
|
|
99
|
+
**Prune candidates:**
|
|
100
|
+
- Expired TTL memories (todos past deadline, stale context)
|
|
101
|
+
- Duplicate/near-duplicate memories (similarity > 0.95)
|
|
102
|
+
- Orphaned facts with 0 recall in 60d
|
|
103
|
+
- Superseded decisions (overridden by newer ones)
|
|
104
|
+
- Out-of-scope memories (wrong project/context)
|
|
105
|
+
|
|
106
|
+
**Rules:**
|
|
107
|
+
- NEVER hard-delete — archive with `status=archived`
|
|
108
|
+
- Show full prune list before executing
|
|
109
|
+
- "Archived X memories" — not "deleted"
|
|
110
|
+
- Allow rescue: user can un-archive any item
|
|
111
|
+
|
|
112
|
+
### 4. Tag Normalization
|
|
113
|
+
**When:** Inconsistent tags reduce recall precision
|
|
114
|
+
|
|
115
|
+
**Common issues:**
|
|
116
|
+
- Synonyms: "frontend" / "front-end" / "FE" → normalize to "frontend"
|
|
117
|
+
- Abbreviations: "db" / "database" / "DB" → normalize to "database"
|
|
118
|
+
- Case: "Auth" / "auth" / "AUTH" → normalize to "auth"
|
|
119
|
+
- Language mix: "xác thực" / "auth" for same concept → pick one
|
|
120
|
+
|
|
121
|
+
**Process:**
|
|
122
|
+
1. Build tag frequency map
|
|
123
|
+
2. Identify synonym clusters
|
|
124
|
+
3. Propose normalization mapping
|
|
125
|
+
4. Apply after user confirms
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Output Format
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
🔄 Memory Evolution Plan
|
|
133
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
134
|
+
|
|
135
|
+
📊 Analysis Results
|
|
136
|
+
Memories analyzed: 127
|
|
137
|
+
Evolution opportunities: 23
|
|
138
|
+
|
|
139
|
+
📋 Proposed Operations
|
|
140
|
+
|
|
141
|
+
CONSOLIDATE (4 groups → 4 memories)
|
|
142
|
+
1. Auth memories: 5 fragments → 1 instruction [preview]
|
|
143
|
+
2. Database facts: 3 fragments → 1 fact [preview]
|
|
144
|
+
...
|
|
145
|
+
|
|
146
|
+
ENRICH (6 memories lacking context)
|
|
147
|
+
1. [decision] "Using Redis" — missing reasoning [add]
|
|
148
|
+
2. [instruction] "Always validate input" — missing scope [add]
|
|
149
|
+
...
|
|
150
|
+
|
|
151
|
+
PRUNE (9 memories)
|
|
152
|
+
1. 4 expired todos (past deadline) [archive]
|
|
153
|
+
2. 3 orphaned facts (0 recall in 60d) [archive]
|
|
154
|
+
3. 2 near-duplicates [merge]
|
|
155
|
+
|
|
156
|
+
NORMALIZE TAGS
|
|
157
|
+
"frontend" / "front-end" / "FE" → "frontend" (affects 18 memories)
|
|
158
|
+
"db" / "database" → "database" (affects 12 memories)
|
|
159
|
+
|
|
160
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
161
|
+
Execute plan? [all / select / cancel]
|
|
162
|
+
> all → execute all operations
|
|
163
|
+
> select → choose operations individually
|
|
164
|
+
> cancel → abort
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
## Execution Protocol
|
|
170
|
+
|
|
171
|
+
1. **Show full plan** — never execute without preview
|
|
172
|
+
2. **Execute in order:** Prune → Consolidate → Enrich → Normalize
|
|
173
|
+
(pruning first reduces noise for better consolidation)
|
|
174
|
+
3. **Checkpoint after each phase** — can stop mid-way
|
|
175
|
+
4. **Create evolution snapshot** before starting (rollback point)
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Post-Evolution Report
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
✅ Evolution Complete
|
|
183
|
+
|
|
184
|
+
Consolidated: 4 memory groups (15 → 4)
|
|
185
|
+
Enriched: 6 memories
|
|
186
|
+
Archived: 9 memories
|
|
187
|
+
Tags normalised: 30 memories updated
|
|
188
|
+
|
|
189
|
+
Brain quality: B- → A- (estimated)
|
|
190
|
+
|
|
191
|
+
💡 Recommended audit in 7 days: /memory-audit
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Rules
|
|
197
|
+
|
|
198
|
+
- **Never auto-prune** — always show prune list to user
|
|
199
|
+
- **Archive, don't delete** — memories may be relevant later
|
|
200
|
+
- **Preserve intent** — consolidation must not lose meaning
|
|
201
|
+
- **Test recall after** — spot-check key topics after evolution
|
|
202
|
+
- **Vietnamese support** — operations work regardless of language
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nm-memory-intake
|
|
3
|
+
description: |
|
|
4
|
+
Structured memory creation workflow. Converts messy notes, meeting logs,
|
|
5
|
+
and unstructured thoughts into well-typed, tagged, priority-scored NeuralMemory entries.
|
|
6
|
+
Uses 1-question-at-a-time clarification + batch preview before storing.
|
|
7
|
+
metadata:
|
|
8
|
+
stage: workflow
|
|
9
|
+
version: "1.0"
|
|
10
|
+
requires: neural-memory (pip install neural-memory)
|
|
11
|
+
tags: [memory, intake, structured, neuralmemory, workflow]
|
|
12
|
+
agent: Memory Intake Specialist
|
|
13
|
+
trigger:
|
|
14
|
+
commands: ["/memory-intake", "/nm-intake"]
|
|
15
|
+
keywords: ["lưu notes", "save this", "remember meeting", "ghi lại buổi"]
|
|
16
|
+
allowed-tools:
|
|
17
|
+
- nmem_remember
|
|
18
|
+
- nmem_recall
|
|
19
|
+
- nmem_stats
|
|
20
|
+
- nmem_context
|
|
21
|
+
- nmem_auto
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# NM Memory Intake — Memory Intake Specialist
|
|
25
|
+
|
|
26
|
+
> Transform raw, unstructured input into high-quality structured memories.
|
|
27
|
+
> Acts as a thoughtful librarian — clarifying, categorizing, and filing
|
|
28
|
+
> information so it can be recalled precisely when needed.
|
|
29
|
+
|
|
30
|
+
## Trigger
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
/memory-intake "raw notes or conversation here"
|
|
34
|
+
/nm-intake "messy meeting notes..."
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Memory Types
|
|
40
|
+
|
|
41
|
+
| Type | Signal Words | Priority |
|
|
42
|
+
|------|-------------|----------|
|
|
43
|
+
| `fact` | "is", "has", "uses", dates, numbers, names | 5 |
|
|
44
|
+
| `decision` | "decided", "chose", "will use", "going with" | 7 |
|
|
45
|
+
| `todo` | "need to", "should", "TODO", "must" | 6 |
|
|
46
|
+
| `error` | "bug", "crash", "failed", "broken", "fix" | 7 |
|
|
47
|
+
| `insight` | "realized", "learned", "turns out", "key takeaway" | 6 |
|
|
48
|
+
| `preference` | "prefer", "always use", "never do", "convention" | 5 |
|
|
49
|
+
| `instruction` | "rule:", "always:", "never:", "when X do Y" | 8 |
|
|
50
|
+
| `workflow` | "process:", "steps:", "first...then...finally" | 6 |
|
|
51
|
+
| `context` | background info, project state, env details | 4 |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Process (6 Phases)
|
|
56
|
+
|
|
57
|
+
### Phase 1: Triage
|
|
58
|
+
Scan raw input → classify each information unit by type.
|
|
59
|
+
If input is ambiguous → go to Phase 2.
|
|
60
|
+
If clearly typed → skip to Phase 3.
|
|
61
|
+
|
|
62
|
+
### Phase 2: Clarification (1-Question-at-a-Time)
|
|
63
|
+
```
|
|
64
|
+
Found: "We're using PostgreSQL now"
|
|
65
|
+
|
|
66
|
+
What type?
|
|
67
|
+
a) Decision — you chose PostgreSQL over alternatives
|
|
68
|
+
b) Fact — PostgreSQL is the current database
|
|
69
|
+
c) Instruction — always use PostgreSQL for this project
|
|
70
|
+
d) Other (explain)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Rules:**
|
|
74
|
+
- ONE question per round — never dump a checklist
|
|
75
|
+
- Always provide options (2-4 choices)
|
|
76
|
+
- Infer when confident (>80%) — don't ask obvious ones
|
|
77
|
+
- Max 5 rounds — then use best-guess
|
|
78
|
+
- Group similar: "Found 3 TODOs. Priority for all? [high/normal/low]"
|
|
79
|
+
|
|
80
|
+
### Phase 3: Enrichment
|
|
81
|
+
For each item, determine:
|
|
82
|
+
1. **Tags** — 2-5 relevant tags, normalize ("frontend" not "front-end")
|
|
83
|
+
2. **Priority** — 0-10 scale (see type table above)
|
|
84
|
+
3. **Expiry** — todo: 30d, error: 90d, fact: none, context: 30d
|
|
85
|
+
4. **Source** — "Per meeting 2026-02-26: ...", "From error log: ..."
|
|
86
|
+
|
|
87
|
+
### Phase 4: Deduplication
|
|
88
|
+
```python
|
|
89
|
+
nmem_recall("topic keywords")
|
|
90
|
+
# → Identical: skip, report duplicate
|
|
91
|
+
# → Updated: store new, note supersedes old
|
|
92
|
+
# → Contradicts: store with conflict flag, alert user
|
|
93
|
+
# → Complements: store, note connection
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Phase 5: Batch Preview + Confirm
|
|
97
|
+
```
|
|
98
|
+
Ready to store 7 memories:
|
|
99
|
+
|
|
100
|
+
1. [decision] "Chose PostgreSQL for user service" priority=7 tags=[database, arch]
|
|
101
|
+
2. [todo] "Migrate user table" priority=6 tags=[database, migration] expires=30d
|
|
102
|
+
3. [fact] "PostgreSQL 16 supports JSON path queries" priority=5 tags=[database]
|
|
103
|
+
...
|
|
104
|
+
|
|
105
|
+
Store all? [yes / edit # / skip # / cancel]
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Rules:**
|
|
109
|
+
- Max 10 per batch — split larger batches with pause
|
|
110
|
+
- NEVER auto-store without showing preview
|
|
111
|
+
- Allow per-item edits before commit
|
|
112
|
+
- Store: decisions first, then errors, then facts (priority order)
|
|
113
|
+
|
|
114
|
+
### Phase 6: Intake Report
|
|
115
|
+
```
|
|
116
|
+
✅ Intake Complete
|
|
117
|
+
Stored: 7 memories (2 decisions, 3 facts, 1 todo, 1 insight)
|
|
118
|
+
Skipped: 1 duplicate
|
|
119
|
+
Conflicts: 0 | Gaps: 2 items need follow-up
|
|
120
|
+
|
|
121
|
+
Follow-up needed:
|
|
122
|
+
- "Redis cache TTL" — what's the agreed TTL?
|
|
123
|
+
- "Deploy schedule" — weekly or bi-weekly?
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Rules
|
|
129
|
+
|
|
130
|
+
- **Never auto-store** — always show preview before writing
|
|
131
|
+
- **Never guess security-sensitive info** — ask explicitly
|
|
132
|
+
- **Prefer specific over vague** — "PostgreSQL 16 on AWS RDS" not "using a database"
|
|
133
|
+
- **Include reasoning** — "Chose X because Y" not just "Using X"
|
|
134
|
+
- **One concept per memory** — don't cram multiple facts
|
|
135
|
+
- **Vietnamese support** — if input is Vietnamese, store in Vietnamese
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: nm-memory-sync
|
|
3
|
+
description: |
|
|
4
|
+
NeuralMemory-powered ambient brain sync. Replaces flat-file memory-sync with
|
|
5
|
+
associative graph recall via spreading activation. Auto-reads/writes brain on
|
|
6
|
+
every session, debug, task, and error — with richer context than keyword matching.
|
|
7
|
+
metadata:
|
|
8
|
+
stage: core
|
|
9
|
+
version: "1.0"
|
|
10
|
+
replaces: memory-sync, ambient-brain
|
|
11
|
+
requires: neural-memory (pip install neural-memory)
|
|
12
|
+
tags: [memory, neural, sync, core, ambient]
|
|
13
|
+
agent: Ambient Neural Brain
|
|
14
|
+
allowed-tools:
|
|
15
|
+
- nmem_remember
|
|
16
|
+
- nmem_recall
|
|
17
|
+
- nmem_context
|
|
18
|
+
- nmem_stats
|
|
19
|
+
- nmem_auto
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
# NM Memory Sync — Ambient Neural Brain
|
|
23
|
+
|
|
24
|
+
> Drop-in upgrade for `memory-sync` and `ambient-brain`.
|
|
25
|
+
> Uses NeuralMemory's spreading activation instead of keyword overlap.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Core Difference vs memory-sync
|
|
30
|
+
|
|
31
|
+
| Feature | memory-sync (flat-file) | nm-memory-sync (this) |
|
|
32
|
+
|---------|------------------------|----------------------|
|
|
33
|
+
| Storage | Markdown files | SQLite graph (neurons + synapses) |
|
|
34
|
+
| Recall | keyword overlap > 2 | Spreading activation graph |
|
|
35
|
+
| Causality | None | `CAUSED_BY`, `LEADS_TO` links |
|
|
36
|
+
| Time decay | None | Natural decay by age/priority |
|
|
37
|
+
| Dedup | None | Automatic conflict detection |
|
|
38
|
+
| Context | Whole file | Scoped activation subgraph |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## READ TRIGGERS (Auto-Read từ Brain)
|
|
43
|
+
|
|
44
|
+
### R1: Session Start
|
|
45
|
+
**Condition:** Conversation bắt đầu
|
|
46
|
+
**Action:** `nmem_context()` → load recent + high-activation memories
|
|
47
|
+
**Output:** Silent loading, brief summary nếu relevant
|
|
48
|
+
|
|
49
|
+
### R2: New Task / Debugging
|
|
50
|
+
**Condition:** User bắt đầu task mới hoặc debug session
|
|
51
|
+
**Action:** `nmem_recall(task_keywords)` → associative recall
|
|
52
|
+
**Output:** Show relevant decisions, past errors, solutions
|
|
53
|
+
|
|
54
|
+
### R3: Error Encountered
|
|
55
|
+
**Condition:** Exception, crash, hoặc lỗi xuất hiện
|
|
56
|
+
**Action:** `nmem_recall(error_type + keywords)` → find past similar errors
|
|
57
|
+
**Output:** Auto-propose known solutions if confidence > 0.7
|
|
58
|
+
|
|
59
|
+
### R4: Architecture Question
|
|
60
|
+
**Condition:** User hỏi về design, pattern, tech choice
|
|
61
|
+
**Action:** `nmem_recall(topic, depth=3)` → deep associative recall
|
|
62
|
+
**Output:** Related decisions, constraints, context
|
|
63
|
+
|
|
64
|
+
### R5: Recurring Problem (Enhanced)
|
|
65
|
+
**Condition:** Vấn đề tương tự đã gặp (spreading activation detects similarity)
|
|
66
|
+
**Action:** Activate related memory cluster
|
|
67
|
+
**Output:** "🧠 Similar to [memory]: [solution]" — NO keyword threshold needed
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## WRITE TRIGGERS (Auto-Write vào Brain)
|
|
72
|
+
|
|
73
|
+
### W1: Decision Made → `decision` type
|
|
74
|
+
**Condition:** AI hoặc user đưa ra quyết định kỹ thuật
|
|
75
|
+
**Capture:** "Chose X because Y" format
|
|
76
|
+
**Store:** `nmem_remember(content, type="decision", priority=7)`
|
|
77
|
+
**Links:** Auto-link to related memories via NeuralMemory engine
|
|
78
|
+
|
|
79
|
+
### W2: Bug Fixed → `error` type
|
|
80
|
+
**Condition:** User confirm fix thành công ("xong", "ok", "chạy rồi")
|
|
81
|
+
**Capture:** Error + root cause + solution
|
|
82
|
+
**Store:** `nmem_remember(content, type="error", priority=8)`
|
|
83
|
+
**Links:** `CAUSED_BY` → triggering condition, `LEADS_TO` → fix applied
|
|
84
|
+
|
|
85
|
+
### W3: Architecture Change → `instruction` type
|
|
86
|
+
**Condition:** File structure thay đổi, pattern mới được áp dụng
|
|
87
|
+
**Capture:** What changed + why
|
|
88
|
+
**Store:** `nmem_remember(content, type="instruction", priority=7)`
|
|
89
|
+
**Links:** `SUPERSEDES` → old pattern if exists
|
|
90
|
+
|
|
91
|
+
### W4: Task Complete → `workflow` type
|
|
92
|
+
**Condition:** Task marked done trong Beads
|
|
93
|
+
**Capture:** What was done + approach taken
|
|
94
|
+
**Store:** `nmem_remember(content, type="workflow", priority=5)`
|
|
95
|
+
|
|
96
|
+
### W5: User Preference Detected → `preference` type
|
|
97
|
+
**Condition:** User consistently uses pattern or expresses preference
|
|
98
|
+
**Capture:** The preference + context
|
|
99
|
+
**Store:** `nmem_remember(content, type="preference", priority=6)`
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Sync Protocol
|
|
104
|
+
|
|
105
|
+
### Session Start Flow
|
|
106
|
+
```
|
|
107
|
+
1. nmem_context() → get active memory cluster
|
|
108
|
+
2. Filter by project tags (from .project-identity if available)
|
|
109
|
+
3. SILENT load — no output unless > 3 highly relevant memories
|
|
110
|
+
4. If relevant: "🧠 Recalled: [brief summary]"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Error Flow
|
|
114
|
+
```
|
|
115
|
+
1. Extract: error_type, file, function, keywords
|
|
116
|
+
2. nmem_recall(f"{error_type} {keywords}", depth=2)
|
|
117
|
+
3. If match (activation > 0.6):
|
|
118
|
+
→ "🧠 Similar error: [past error] — Solution: [fix]"
|
|
119
|
+
4. After fix confirmed:
|
|
120
|
+
→ nmem_remember(error + solution, type="error", tags=[...])
|
|
121
|
+
→ Create CAUSED_BY + LEADS_TO synapses
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Decision Write Flow
|
|
125
|
+
```
|
|
126
|
+
1. Detect decision signal words: "chose", "decided", "going with", "will use"
|
|
127
|
+
2. Extract: choice + reason (requires both for quality decision memory)
|
|
128
|
+
3. nmem_recall(topic) → check for conflicts
|
|
129
|
+
4. SILENT store: nmem_remember(content, type="decision", priority=7)
|
|
130
|
+
5. Confirm: "💾 Saved decision: [brief]"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Associative Recall Strategy
|
|
136
|
+
|
|
137
|
+
Unlike keyword overlap (old memory-sync), nm-memory-sync uses:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
Query: "API authentication failing"
|
|
141
|
+
↓ spreading activation
|
|
142
|
+
Anchor neurons: [api, auth, fail]
|
|
143
|
+
↓ activate synapses (depth=2)
|
|
144
|
+
Related neurons: [jwt, token, session, middleware]
|
|
145
|
+
↓ intersect top activations
|
|
146
|
+
Surface memories:
|
|
147
|
+
- "Decided JWT over sessions for stateless API" (decision, auth tags)
|
|
148
|
+
- "Fixed middleware order causing 401" (error, api tags)
|
|
149
|
+
- "Never store tokens in localStorage" (instruction, security tags)
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
This surfaces memories that a keyword search would miss.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## Notification Behavior
|
|
157
|
+
|
|
158
|
+
| Event | Output |
|
|
159
|
+
|-------|--------|
|
|
160
|
+
| Relevant memory found (activation > 0.7) | `🧠 [brief recall]` |
|
|
161
|
+
| Decision auto-saved | `💾 Saved: [brief]` |
|
|
162
|
+
| Bug solution stored | `🔧 Stored fix: [brief]` |
|
|
163
|
+
| No relevant memory | Silent (no output) |
|
|
164
|
+
| Conflict detected | `⚠️ Conflicts with: [memory]` |
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Fallback Mode (NeuralMemory Not Installed)
|
|
169
|
+
|
|
170
|
+
If `nmem` is not available, falls back to flat-file behavior:
|
|
171
|
+
```
|
|
172
|
+
- Reads from brain/decisions/, brain/solutions/
|
|
173
|
+
- Keyword overlap matching (legacy behavior)
|
|
174
|
+
- Shows warning once: "⚠️ NeuralMemory not installed. Using flat-file fallback."
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Integration
|
|
180
|
+
|
|
181
|
+
- Works alongside `beads-manager` for task lifecycle hooks
|
|
182
|
+
- Reads `.project-identity` for project-scoped memory filtering
|
|
183
|
+
- Feeds data to `nm-memory-audit` for quality checks
|
|
184
|
+
- Activated before `orchestrator` dispatches (priority 2.5 in skill chain)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# 🗺️ Phase 0: Discovery (Satellite View)
|
|
2
|
+
|
|
3
|
+
> **Zoom Level:** 0 — Bird's Eye
|
|
4
|
+
> **Goal:** Create an "App Map" — understand WHAT the app is and WHAT it contains.
|
|
5
|
+
> **Output:** Diagrams, tables, maps. **NO CODE.**
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## ⛔ OUTPUT RULE
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
✅ ALLOWED: ASCII diagrams, Mermaid, tables, bullet lists, bash scan commands
|
|
13
|
+
❌ BLOCKED: Kotlin/Java code, function signatures, class definitions
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 📋 Sub-steps
|
|
19
|
+
|
|
20
|
+
### 0.1: Confirm Input
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
🔧 Android Reverse Engineering bắt đầu!
|
|
24
|
+
|
|
25
|
+
Em cần biết:
|
|
26
|
+
1. Thư mục Apktool output ở đâu?
|
|
27
|
+
2. Tên app gốc? Package name?
|
|
28
|
+
|
|
29
|
+
Chưa chạy Apktool? → apktool d your-app.apk -o ./decompiled/
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 0.2: Structure Scan
|
|
33
|
+
|
|
34
|
+
Quét folder structure để hiểu quy mô app:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# Top-level packages (app code vs libraries)
|
|
38
|
+
find [apktool_dir]/smali -maxdepth 3 -type d | sed 's|.*/smali/||' | sort
|
|
39
|
+
|
|
40
|
+
# Multi-dex check
|
|
41
|
+
find [apktool_dir] -name "smali*" -maxdepth 1 -type d
|
|
42
|
+
|
|
43
|
+
# Resource overview
|
|
44
|
+
ls [apktool_dir]/res/layout/ | wc -l # Number of layouts
|
|
45
|
+
ls [apktool_dir]/res/drawable*/ | wc -l # Number of drawables
|
|
46
|
+
cat [apktool_dir]/res/values/strings.xml | grep '<string' | wc -l # Strings count
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 0.3: Library Detection
|
|
50
|
+
|
|
51
|
+
Quét smali directories để nhận diện thư viện. Ref: `library-patterns.md`
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Known library packages
|
|
55
|
+
find [apktool_dir]/smali -maxdepth 3 -type d | grep -E "(google|facebook|squareup|airbnb|bumptech|jakewharton|reactivex|greenrobot)" | sort
|
|
56
|
+
|
|
57
|
+
# Native libraries
|
|
58
|
+
find [apktool_dir]/lib -name "*.so" 2>/dev/null
|
|
59
|
+
|
|
60
|
+
# Assets (ML models, WebView, configs)
|
|
61
|
+
ls [apktool_dir]/assets/ 2>/dev/null
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Phân loại thành 5 nhóm:**
|
|
65
|
+
|
|
66
|
+
| Category | Meaning | Action |
|
|
67
|
+
|----------|---------|--------|
|
|
68
|
+
| ✅ Reuse | Modern, still maintained | Add to build.gradle |
|
|
69
|
+
| 🔄 Replace | Legacy/deprecated | Map to modern replacement |
|
|
70
|
+
| 🔵 Firebase/Google | Platform SDKs | Use latest version |
|
|
71
|
+
| 📱 Native (.so) | JNI libraries | Keep, create bridge |
|
|
72
|
+
| 🏷️ App Code | Original app logic | Rebuild in Kotlin |
|
|
73
|
+
|
|
74
|
+
### 0.4: Manifest Analysis
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
cat [apktool_dir]/AndroidManifest.xml
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Extract:
|
|
81
|
+
- Application ID + Package name
|
|
82
|
+
- Min/Target SDK
|
|
83
|
+
- Permissions (grouped by category)
|
|
84
|
+
- Entry points: Application class, Launcher Activity
|
|
85
|
+
- All components: Activities, Services, Receivers, Providers
|
|
86
|
+
- Deep links / Intent filters
|
|
87
|
+
|
|
88
|
+
### 0.5: Screen Map
|
|
89
|
+
|
|
90
|
+
Map Activities → future Compose screens. Draw navigation flow:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
Activities found → Group by feature → Draw screen graph
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 0.6: Complexity Estimate
|
|
97
|
+
|
|
98
|
+
Rate each area 1-5 dots:
|
|
99
|
+
- Data Layer: ●●●○○ (APIs, DB, preferences)
|
|
100
|
+
- Core Logic: ●●○○○ (crypto, formatters, utils)
|
|
101
|
+
- UI Screens: ●●●●○ (screen count, complex layouts)
|
|
102
|
+
- SDK Integration: ●●○○○ (third-party, native libs)
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 📊 Output: App Map
|
|
107
|
+
|
|
108
|
+
Use template from `templates/app-map.md`. Must include:
|
|
109
|
+
|
|
110
|
+
1. **Identity** — package, SDK levels, screen count
|
|
111
|
+
2. **Screen Flow** — navigation graph (ASCII or Mermaid)
|
|
112
|
+
3. **Library Landscape** — categorized dependency list
|
|
113
|
+
4. **Complexity Estimate** — visual dots rating
|
|
114
|
+
5. **Key Observations** — anything notable (obfuscation, unusual patterns)
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## ✅ Gate
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
"🗺️ Đây là App Map. Anh review xem có gì cần diều chỉnh không?"
|
|
122
|
+
→ User approves → Proceed to Phase 1 (Architecture)
|
|
123
|
+
→ User has questions → Investigate and update map
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
*Phase 0: Discovery — No code, just understanding*
|