Skip to content

fix(strategy): use ~/.stratiki/strategy and company wiki for grounding - #14

Open
divo12 wants to merge 1 commit into
mainfrom
cursor/fix-strategy-storage-927a
Open

fix(strategy): use ~/.stratiki/strategy and company wiki for grounding#14
divo12 wants to merge 1 commit into
mainfrom
cursor/fix-strategy-storage-927a

Conversation

@divo12

@divo12 divo12 commented Sep 1, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the strategy storage location to use ~/.stratiki/strategy and grounds decisions against the company brain wiki as required.

Bug Fixed

PR #13 incorrectly used:

  • openWikiStrategyDir pointing to ~/.openwiki/strategy
  • path.join(process.cwd(), "openwiki") for grounding context

Changes

  • Added getStratikiStrategyDir() lazy getter returning ~/.stratiki/strategy
  • Updated ensureStratikiHome() to create strategy directory
  • Removed openWikiStrategyDir constant (unused elsewhere)
  • Updated runStrategyCommand to:
    • Use getStratikiStrategyDir() for storage
    • Use getStratikiCompanyWikiDir() for grounding context
    • Call ensureStratikiHome() before saving decisions
  • Updated documentation in store.ts to specify ~/.stratiki/strategy

Store Path in Code

export function getStratikiStrategyDir(): string {
  if (_stratikiStrategyDir === undefined) {
    _stratikiStrategyDir = path.join(getStratikiHomeDir(), "strategy");
  }
  return _stratikiStrategyDir;
}

Storage: ~/.stratiki/strategy/
Grounding: ~/.stratiki/wiki/ (company brain)

Testing

  • Small targeted diff (3 files, 22 insertions, 8 deletions)
  • pnpm format and pnpm lint pass
  • Ready to merge after test verification

Related

Fixes incorrect storage location from PR #13 (merged as f0fd99b)

Open in Web Open in Cursor 

Summary by cubic

Fixes the strategy command to store decisions in ~/.stratiki/strategy and ground against the company wiki instead of the previous openwiki paths (~/.openwiki/strategy and process.cwd()/openwiki). This corrects PR #13's incorrect storage location.

Written for commit 48caa8b. Summary will update on new commits.

Review in cubic

- Add getStratikiStrategyDir() lazy getter
- Update ensureStratikiHome() to create strategy directory
- Remove unused openWikiStrategyDir constant
- Use getStratikiCompanyWikiDir() instead of process.cwd()/openwiki
- Call ensureStratikiHome() before saving decisions
- Update store documentation to specify ~/.stratiki/strategy

Co-authored-by: divo12 <divo12@users.noreply.github.com>
@divo12
divo12 marked this pull request as ready for review September 1, 2026 06:59

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/cli/runners.ts">

<violation number="1" location="src/cli/runners.ts:441">
P2: Users with decisions created by the previous strategy command lose them from `strategy list` after this change because the store reads only the new directory. Migrate the legacy files or make reads fall back to the old directory before switching writes.</violation>

<violation number="2" location="src/cli/runners.ts:467">
P2: On a fresh Stratiki setup the seed runs against a nonexistent ~/.stratiki/wiki/ because `buildFromDirectory(companyWikiDir)` executes before `ensureStratikiHome()` creates it. `listMarkdownFiles` catches the ENOENT and returns an empty index, so the seed silently produces fully ungrounded goals (`groundedIn: []`) and exits 0 with no warning that grounding had no content. Call `ensureStratikiHome()` before `buildFromDirectory`, and warn when the index contains no grounding pages.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/cli/runners.ts

const strategyDir = getStratikiStrategyDir();
const companyWikiDir = getStratikiCompanyWikiDir();
const store = new FileStrategyStore(strategyDir);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Users with decisions created by the previous strategy command lose them from strategy list after this change because the store reads only the new directory. Migrate the legacy files or make reads fall back to the old directory before switching writes.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/cli/runners.ts, line 441:

<comment>Users with decisions created by the previous strategy command lose them from `strategy list` after this change because the store reads only the new directory. Migrate the legacy files or make reads fall back to the old directory before switching writes.</comment>

<file context>
@@ -430,9 +430,15 @@ export async function runStrategyCommand(
+
+  const strategyDir = getStratikiStrategyDir();
+  const companyWikiDir = getStratikiCompanyWikiDir();
+  const store = new FileStrategyStore(strategyDir);
 
   if (command.action === "list") {
</file context>

Comment thread src/cli/runners.ts

const decision = parseDecisionSeed({ description: command.description });
const index = await ContextIndex.buildFromDirectory(bookDir);
const index = await ContextIndex.buildFromDirectory(companyWikiDir);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: On a fresh Stratiki setup the seed runs against a nonexistent ~/.stratiki/wiki/ because buildFromDirectory(companyWikiDir) executes before ensureStratikiHome() creates it. listMarkdownFiles catches the ENOENT and returns an empty index, so the seed silently produces fully ungrounded goals (groundedIn: []) and exits 0 with no warning that grounding had no content. Call ensureStratikiHome() before buildFromDirectory, and warn when the index contains no grounding pages.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/cli/runners.ts, line 467:

<comment>On a fresh Stratiki setup the seed runs against a nonexistent ~/.stratiki/wiki/ because `buildFromDirectory(companyWikiDir)` executes before `ensureStratikiHome()` creates it. `listMarkdownFiles` catches the ENOENT and returns an empty index, so the seed silently produces fully ungrounded goals (`groundedIn: []`) and exits 0 with no warning that grounding had no content. Call `ensureStratikiHome()` before `buildFromDirectory`, and warn when the index contains no grounding pages.</comment>

<file context>
@@ -458,9 +464,10 @@ export async function runStrategyCommand(
 
   const decision = parseDecisionSeed({ description: command.description });
-  const index = await ContextIndex.buildFromDirectory(bookDir);
+  const index = await ContextIndex.buildFromDirectory(companyWikiDir);
   try {
     const result = decomposeDecision(decision, index);
</file context>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants