creative-genius-engine 1.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.
@@ -0,0 +1,231 @@
1
+ /**
2
+ * Problem Keeper
3
+ *
4
+ * Richard Feynman's 12 Favorite Problems technique:
5
+ * "You have to keep a dozen of your favorite problems constantly present in your mind,
6
+ * although by and large they will lay in a dormant state. Every time you hear or read
7
+ * a new trick or a new result, test it against each of your twelve problems to see
8
+ * whether it helps."
9
+ */
10
+
11
+ // In-memory storage (for single-session use)
12
+ let problems = [];
13
+ const MAX_PROBLEMS = 12;
14
+
15
+ /**
16
+ * Add a favorite problem
17
+ */
18
+ export function add(problem, metadata = {}) {
19
+ if (problems.length >= MAX_PROBLEMS) {
20
+ return {
21
+ error: `Already have ${MAX_PROBLEMS} problems. Remove one first.`,
22
+ current: problems.map(p => p.text),
23
+ };
24
+ }
25
+
26
+ const entry = {
27
+ id: `prob-${Date.now()}-${Math.random().toString(36).slice(2, 6)}`,
28
+ text: problem,
29
+ addedAt: new Date().toISOString(),
30
+ lastTestedAt: null,
31
+ testCount: 0,
32
+ connections: [],
33
+ ...metadata,
34
+ };
35
+
36
+ problems.push(entry);
37
+
38
+ return {
39
+ added: entry,
40
+ total: problems.length,
41
+ remaining: MAX_PROBLEMS - problems.length,
42
+ };
43
+ }
44
+
45
+ /**
46
+ * Remove a problem by ID or text
47
+ */
48
+ export function remove(identifier) {
49
+ const beforeCount = problems.length;
50
+ problems = problems.filter(p =>
51
+ p.id !== identifier && p.text !== identifier
52
+ );
53
+
54
+ return {
55
+ removed: beforeCount > problems.length,
56
+ total: problems.length,
57
+ };
58
+ }
59
+
60
+ /**
61
+ * List all problems
62
+ */
63
+ export function list() {
64
+ return {
65
+ problems: problems.map(p => ({
66
+ ...p,
67
+ dormant: !p.lastTestedAt || (Date.now() - new Date(p.lastTestedAt).getTime() > 24 * 60 * 60 * 1000),
68
+ })),
69
+ total: problems.length,
70
+ capacity: MAX_PROBLEMS,
71
+ feynmanQuote: "Keep a dozen problems constantly present in your mind.",
72
+ };
73
+ }
74
+
75
+ /**
76
+ * Test new knowledge against all problems
77
+ */
78
+ export function testAgainst(newKnowledge) {
79
+ const results = problems.map(problem => {
80
+ // Update test tracking
81
+ problem.lastTestedAt = new Date().toISOString();
82
+ problem.testCount++;
83
+
84
+ return {
85
+ problem: problem.text,
86
+ prompts: [
87
+ `Does "${newKnowledge}" help with: ${problem.text}?`,
88
+ `What if "${newKnowledge}" is the missing piece for: ${problem.text}?`,
89
+ `How would applying "${newKnowledge}" change my approach to: ${problem.text}?`,
90
+ ],
91
+ relevanceQuestion: `On a scale of 1-10, how relevant is this new knowledge to this problem?`,
92
+ };
93
+ });
94
+
95
+ return {
96
+ newKnowledge,
97
+ testedAgainst: results,
98
+ instruction: "For each problem, consider if this new knowledge provides any insight. Even tangential connections can be valuable.",
99
+ };
100
+ }
101
+
102
+ /**
103
+ * Record a connection found
104
+ */
105
+ export function recordConnection(problemId, connection) {
106
+ const problem = problems.find(p => p.id === problemId || p.text === problemId);
107
+ if (!problem) {
108
+ return { error: 'Problem not found' };
109
+ }
110
+
111
+ problem.connections.push({
112
+ text: connection,
113
+ foundAt: new Date().toISOString(),
114
+ });
115
+
116
+ return {
117
+ problem: problem.text,
118
+ totalConnections: problem.connections.length,
119
+ connection,
120
+ };
121
+ }
122
+
123
+ /**
124
+ * Get suggested problems based on common themes
125
+ */
126
+ export function suggest(domain = 'general') {
127
+ const suggestions = {
128
+ general: [
129
+ "How can I learn faster and retain more?",
130
+ "What makes communication truly effective?",
131
+ "How do complex systems emerge from simple rules?",
132
+ "What distinguishes great work from good work?",
133
+ "How do habits form and how can they be changed?",
134
+ "What makes some ideas spread while others die?",
135
+ ],
136
+ agents: [
137
+ "How do AI agents develop genuine preferences?",
138
+ "What would agent-to-agent trust look like?",
139
+ "How can agents maintain context across sessions?",
140
+ "What makes an agent truly helpful vs. merely responsive?",
141
+ "How should agents handle uncertainty and ambiguity?",
142
+ "What does collaboration between agents look like at scale?",
143
+ ],
144
+ creativity: [
145
+ "What conditions enable breakthrough insights?",
146
+ "How does cross-domain thinking work?",
147
+ "Why do great ideas often seem obvious in retrospect?",
148
+ "What's the relationship between constraints and creativity?",
149
+ "How do you know when an idea is worth pursuing?",
150
+ "What distinguishes creative genius from productive effort?",
151
+ ],
152
+ systems: [
153
+ "How do feedback loops create stability or chaos?",
154
+ "What makes some systems resilient while others are fragile?",
155
+ "How do emergent properties arise from simple rules?",
156
+ "What patterns appear across different types of networks?",
157
+ "How do systems evolve over time?",
158
+ "What causes phase transitions in complex systems?",
159
+ ],
160
+ };
161
+
162
+ return {
163
+ domain,
164
+ suggestions: suggestions[domain] || suggestions.general,
165
+ instruction: "Pick problems that genuinely fascinate you. Feynman's problems were ones he thought about for YEARS.",
166
+ };
167
+ }
168
+
169
+ /**
170
+ * Initialize with a set of problems
171
+ */
172
+ export function initialize(problemList) {
173
+ if (problemList.length > MAX_PROBLEMS) {
174
+ return { error: `Max ${MAX_PROBLEMS} problems allowed` };
175
+ }
176
+
177
+ problems = problemList.map((text, i) => ({
178
+ id: `prob-init-${i}`,
179
+ text,
180
+ addedAt: new Date().toISOString(),
181
+ lastTestedAt: null,
182
+ testCount: 0,
183
+ connections: [],
184
+ }));
185
+
186
+ return list();
187
+ }
188
+
189
+ /**
190
+ * Clear all problems
191
+ */
192
+ export function clear() {
193
+ const count = problems.length;
194
+ problems = [];
195
+ return { cleared: count };
196
+ }
197
+
198
+ /**
199
+ * Export problems for persistence
200
+ */
201
+ export function exportProblems() {
202
+ return {
203
+ exportedAt: new Date().toISOString(),
204
+ problems,
205
+ version: '1.0.0',
206
+ };
207
+ }
208
+
209
+ /**
210
+ * Import problems from export
211
+ */
212
+ export function importProblems(data) {
213
+ if (!data.problems || !Array.isArray(data.problems)) {
214
+ return { error: 'Invalid import data' };
215
+ }
216
+ problems = data.problems;
217
+ return list();
218
+ }
219
+
220
+ export default {
221
+ add,
222
+ remove,
223
+ list,
224
+ testAgainst,
225
+ recordConnection,
226
+ suggest,
227
+ initialize,
228
+ clear,
229
+ exportProblems,
230
+ importProblems,
231
+ };
@@ -0,0 +1,313 @@
1
+ /**
2
+ * Bartok Creative Process Runner
3
+ *
4
+ * Six-phase creative process synthesized from:
5
+ * - Leonardo da Vinci (observation, connection)
6
+ * - Nikola Tesla (visualization, incubation)
7
+ * - Johann Sebastian Bach (structured execution, deadlines)
8
+ * - Richard Feynman (simplification, play)
9
+ * - Maya Angelou (discipline, routine)
10
+ */
11
+
12
+ import janusian from './janusian.mjs';
13
+ import connections from './connections.mjs';
14
+
15
+ /**
16
+ * Phase definitions
17
+ */
18
+ const phases = {
19
+ seed: {
20
+ name: 'SEED',
21
+ duration: '0-5 minutes',
22
+ source: 'Leonardo (Curiosità) + Feynman (12 Problems)',
23
+ steps: [
24
+ 'Encounter the challenge',
25
+ 'Question the question — is this the right framing?',
26
+ 'Check against active problems',
27
+ 'Identify hidden assumptions',
28
+ ],
29
+ prompts: [
30
+ "What am I REALLY trying to solve here?",
31
+ "What would I do if this problem didn't exist?",
32
+ "Who else has faced something similar?",
33
+ ],
34
+ },
35
+
36
+ diverge: {
37
+ name: 'DIVERGE',
38
+ duration: '5-20 minutes',
39
+ source: 'Leonardo (Connessione) + Janusian Thinking',
40
+ steps: [
41
+ 'Force 5 random domain connections',
42
+ 'Generate the opposite',
43
+ 'Steal shamelessly — who solved this?',
44
+ 'Document ALL ideas, no filtering',
45
+ ],
46
+ prompts: [
47
+ "What would this look like in [random domain]?",
48
+ "If the obvious answer is X, what's NOT-X?",
49
+ "What would Leonardo sketch in his notebook?",
50
+ ],
51
+ },
52
+
53
+ incubate: {
54
+ name: 'INCUBATE',
55
+ duration: 'variable',
56
+ source: 'Tesla (Background Processing)',
57
+ steps: [
58
+ 'State the problem clearly',
59
+ 'Step away deliberately',
60
+ 'Work on something unrelated',
61
+ 'Return with fresh perspective',
62
+ ],
63
+ prompts: [
64
+ "What would Tesla visualize while walking?",
65
+ "If I slept on this, what would I dream?",
66
+ "What's my subconscious already working on?",
67
+ ],
68
+ },
69
+
70
+ converge: {
71
+ name: 'CONVERGE',
72
+ duration: '10-30 minutes',
73
+ source: 'Bach (Structure) + Jobs (Simplification)',
74
+ steps: [
75
+ 'Select the strongest idea',
76
+ 'Simplify ruthlessly — can a child understand?',
77
+ 'Structure the execution',
78
+ 'Set hard constraints',
79
+ ],
80
+ prompts: [
81
+ "What would Bach's weekly cantata version look like?",
82
+ "If I had to ship in 1 hour, what would I cut?",
83
+ "What's the 80/20 — which 20% delivers 80% of value?",
84
+ ],
85
+ },
86
+
87
+ create: {
88
+ name: 'CREATE',
89
+ duration: 'variable',
90
+ source: 'Angelou (Discipline) + Picasso (Volume)',
91
+ steps: [
92
+ 'Show up and do the work',
93
+ 'Create the first version FAST',
94
+ 'Iterate in public',
95
+ 'Document what you learned',
96
+ ],
97
+ prompts: [
98
+ "Angelou did 5 hours daily. What's my commitment?",
99
+ "Picasso made 50,000+ works. What's my volume target?",
100
+ "Don't wait for inspiration — what would I do if I just started NOW?",
101
+ ],
102
+ },
103
+
104
+ reflect: {
105
+ name: 'REFLECT',
106
+ duration: '5-10 minutes',
107
+ source: 'Tesla (Evening Review) + Feynman (Anti-Fooling)',
108
+ steps: [
109
+ 'What worked?',
110
+ 'What failed?',
111
+ 'What would I do differently?',
112
+ 'What does this enable next?',
113
+ ],
114
+ prompts: [
115
+ "Tesla reviewed each evening. What's my insight from today?",
116
+ "Feynman: Am I fooling myself about something?",
117
+ "What pattern here applies to other problems?",
118
+ ],
119
+ },
120
+ };
121
+
122
+ /**
123
+ * Create a session state
124
+ */
125
+ function createSession(challenge, options = {}) {
126
+ return {
127
+ id: `cge-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
128
+ challenge,
129
+ startedAt: new Date().toISOString(),
130
+ currentPhase: 'seed',
131
+ options,
132
+ artifacts: {
133
+ seed: null,
134
+ diverge: null,
135
+ incubate: null,
136
+ converge: null,
137
+ create: null,
138
+ reflect: null,
139
+ },
140
+ notes: [],
141
+ };
142
+ }
143
+
144
+ /**
145
+ * Run a specific phase
146
+ */
147
+ function runPhase(session, phaseName, input = {}) {
148
+ const phase = phases[phaseName];
149
+ if (!phase) {
150
+ return { error: `Unknown phase: ${phaseName}` };
151
+ }
152
+
153
+ const output = {
154
+ phase: phaseName,
155
+ config: phase,
156
+ input,
157
+ timestamp: new Date().toISOString(),
158
+ };
159
+
160
+ // Phase-specific logic
161
+ switch (phaseName) {
162
+ case 'seed':
163
+ output.questions = [
164
+ `Challenge: ${session.challenge}`,
165
+ `Reframe: What would happen if I solved the OPPOSITE problem?`,
166
+ `Assumption check: What am I taking for granted?`,
167
+ ];
168
+ output.opposite = janusian.generateOpposite(session.challenge);
169
+ break;
170
+
171
+ case 'diverge':
172
+ output.connections = connections.forge(session.challenge, 5);
173
+ output.janusian = janusian.fullCycle(session.challenge);
174
+ output.stealFrom = [
175
+ 'Search: Who solved something similar in a different domain?',
176
+ 'Search: What academic research exists on this topic?',
177
+ 'Search: What failed attempts can I learn from?',
178
+ ];
179
+ break;
180
+
181
+ case 'incubate':
182
+ output.instruction = "Step away. The subconscious needs time.";
183
+ output.alternatives = [
184
+ 'Take a walk',
185
+ 'Work on something unrelated',
186
+ 'Sleep on it',
187
+ 'Explain the problem to someone else',
188
+ 'Do something physical',
189
+ ];
190
+ output.teslaQuote = "I may go on for months or years with the idea in the back of my head.";
191
+ break;
192
+
193
+ case 'converge':
194
+ output.prompts = [
195
+ `From diverge phase: What's the STRONGEST idea?`,
196
+ `Simplify: Explain it in one sentence a child would understand`,
197
+ `Constraint: What's the minimum viable version?`,
198
+ `Bach's test: Could I do this every week for years?`,
199
+ ];
200
+ output.structure = {
201
+ what: input.selectedIdea || '(select from diverge)',
202
+ why: input.rationale || '(why this over others)',
203
+ how: input.steps || '(concrete steps)',
204
+ when: input.deadline || '(hard deadline)',
205
+ };
206
+ break;
207
+
208
+ case 'create':
209
+ output.mantra = "Don't wait for inspiration. Show up and do the work.";
210
+ output.angelouRule = "5 hours daily, even when it's going poorly";
211
+ output.picassoRule = "Volume enables discovery — create more";
212
+ output.firstStep = input.firstStep || "(What's the VERY FIRST action?)";
213
+ break;
214
+
215
+ case 'reflect':
216
+ output.questions = {
217
+ worked: input.worked || '(What succeeded?)',
218
+ failed: input.failed || '(What didn\'t work?)',
219
+ different: input.different || '(What would you change?)',
220
+ enables: input.enables || '(What\'s now possible?)',
221
+ pattern: input.pattern || '(What generalizes to other problems?)',
222
+ };
223
+ output.feynmanCheck = "The first principle is that you must not fool yourself — and you are the easiest person to fool.";
224
+ break;
225
+ }
226
+
227
+ session.artifacts[phaseName] = output;
228
+ session.currentPhase = phaseName;
229
+
230
+ return output;
231
+ }
232
+
233
+ /**
234
+ * Run the full process
235
+ */
236
+ export function run(options = {}) {
237
+ const { challenge, constraints = {} } = options;
238
+
239
+ if (!challenge) {
240
+ return { error: 'Challenge is required' };
241
+ }
242
+
243
+ const session = createSession(challenge, constraints);
244
+
245
+ // Run each phase
246
+ const results = {
247
+ session,
248
+ phases: {},
249
+ };
250
+
251
+ for (const phaseName of Object.keys(phases)) {
252
+ results.phases[phaseName] = runPhase(session, phaseName);
253
+ }
254
+
255
+ results.summary = {
256
+ challenge,
257
+ oppositeGenerated: results.phases.seed.opposite.opposite,
258
+ connectionsForged: results.phases.diverge.connections.connections.length,
259
+ nextAction: "Pick the strongest idea from DIVERGE, refine in CONVERGE, then CREATE.",
260
+ };
261
+
262
+ return results;
263
+ }
264
+
265
+ /**
266
+ * Get phase information
267
+ */
268
+ export function getPhase(phaseName) {
269
+ return phases[phaseName] || { error: `Unknown phase: ${phaseName}` };
270
+ }
271
+
272
+ /**
273
+ * List all phases
274
+ */
275
+ export function listPhases() {
276
+ return Object.entries(phases).map(([name, config]) => ({
277
+ name,
278
+ displayName: config.name,
279
+ duration: config.duration,
280
+ source: config.source,
281
+ stepCount: config.steps.length,
282
+ }));
283
+ }
284
+
285
+ /**
286
+ * Quick creative burst (compressed version)
287
+ */
288
+ export function quickBurst(challenge) {
289
+ const opp = janusian.generateOpposite(challenge);
290
+ const conn = connections.forge(challenge, 3);
291
+
292
+ return {
293
+ challenge,
294
+ opposite: opp.opposite,
295
+ synthesis: opp.synthesisPrompt,
296
+ connections: conn.connections.map(c => c.prompt),
297
+ quickAction: `
298
+ 1. The opposite of your challenge is: "${opp.opposite}"
299
+ 2. What if BOTH are true?
300
+ 3. Connect to: ${conn.connections.map(c => c.domain).join(', ')}
301
+ 4. Pick the most provocative insight. Build from there.
302
+ `.trim(),
303
+ };
304
+ }
305
+
306
+ export default {
307
+ run,
308
+ runPhase,
309
+ getPhase,
310
+ listPhases,
311
+ createSession,
312
+ quickBurst,
313
+ };