Skip to content

[PF-10] Plan mode URL pre-fetch flow and unified context file with plan slug - #29

Merged
chucoding merged 2 commits into
developfrom
feature/PF-10_chat
Mar 14, 2026
Merged

[PF-10] Plan mode URL pre-fetch flow and unified context file with plan slug#29
chucoding merged 2 commits into
developfrom
feature/PF-10_chat

Conversation

@chucoding

Copy link
Copy Markdown
Owner

Purpose

  • Fix timeout when /p or planforge plan is run with website/Notion links in the goal by pre-fetching URL content before running the sandbox and injecting it into context.
  • Store chat history and URL content in a single context file and align its filename with the plan file (HHMM-<slug>.md / HHMM-<slug>.plan.md) using a shared slug and the new --slug option.

Description

1. p skill (Plan URL pre-fetch and context format)

  • .cursor/skills/p/SKILL.md, templates/cursor/skills/p/SKILL.md
    • Step 0 (Pre-fetch URLs): If the goal contains URLs, fetch them before running the plan script: Notion URLs via MCP notion-fetch (server user-Notion), other web URLs via mcp_web_fetch. Combine successful results into markdown and keep for step 1.
    • Step 1 (Single context file): Derive a slug from the goal (same rules as plan command: lowercase ASCII, hyphens, max 2 hyphens). Write one file to .cursor/contexts/YYYY-MM-DD/HHMM-<slug>.md containing:
      • Chat history in Cursor Chat History format only (no long prose summary): User : {Q1}, Agent : {A1}, … and the line "Use this conversation to understand the user's intent and as reference when creating the plan."
      • If URL content was fetched in step 0, append it as a section in the same file.
    • Step 2: Run planforge plan "<goal>" --slug <slug> so the plan file is created as HHMM-<slug>.plan.md, matching the context filename.
  • All skill copy is in English.

2. plan command --slug option (cli-js / cli-py)

  • packages/cli-js/src/index.ts: Added --slug <slug> to the plan command; passed to runPlan.
  • packages/cli-js/src/commands/plan.ts: PlanCliOpts.slug; when set, normalize and validate slug and use it for the plan output filename (HHMM-<slug>.plan.md) instead of parsing from plan body or slugifying the goal.
  • packages/cli-py/planforge/cli.py: Added --slug to the plan command; passed to run_plan.
  • packages/cli-py/planforge/commands/plan.py: When opts.get("slug") is present, use it for the plan output filename (with same validation / hyphen limit).

3. CLI URL pre-fetch (terminal users, optional)

  • packages/cli-js/src/utils/url-fetch.ts (new): extractUrlsFromGoal(goal), fetchUrlContent(url, timeoutMs), fetchUrlsContext(goal). Skips Notion URLs; fetches other http(s) URLs with 10s timeout and returns a "Fetched URLs" markdown block.
  • packages/cli-js/src/commands/plan.ts: After loadMergedContext, call fetchUrlsContext(goal) and prepend result to context when present.
  • packages/cli-py/planforge/utils/url_fetch.py (new): Same semantics (extract URLs, skip Notion, fetch with urllib.request, 10s timeout, max body cap).
  • packages/cli-py/planforge/commands/plan.py: After load_merged_context, call fetch_urls_context(goal) and prepend to context when present.

Files changed (summary)

Area Files
Skill .cursor/skills/p/SKILL.md, templates/cursor/skills/p/SKILL.md
cli-js src/index.ts, src/commands/plan.ts, src/utils/url-fetch.ts (new)
cli-py planforge/cli.py, planforge/commands/plan.py, planforge/utils/url_fetch.py (new)

run_plan.ps1 / run_plan.sh already forward arguments, so --slug is passed through without change.

How to test

  1. p skill and context file

    • In Cursor, run /p with a goal that includes a web URL (e.g. https://example.com) or a Notion URL (if MCP is configured). Confirm that the agent pre-fetches URLs, writes one context file under .cursor/contexts/YYYY-MM-DD/HHMM-<slug>.md with Cursor Chat History format and optional URL section, and runs planforge plan "<goal>" --slug <slug>.
    • After the plan is created, confirm the plan file is .cursor/plans/YYYY-MM-DD/HHMM-<slug>.plan.md with the same <slug> as the context file.
  2. --slug option

    • Run planforge plan "some goal" --slug my-slug (cli-js or cli-py). Confirm the created plan file is HHMM-my-slug.plan.md.
  3. CLI URL fetch (terminal)

    • Run planforge plan "check this page https://example.com" from the terminal (no Cursor). Confirm that the planner receives context that includes fetched content for the URL (e.g. "Fetched URLs" section). Notion URLs in the goal should be skipped by the CLI.

Review Requirement

  • p skill: Step order (0 → 1 → 2), Cursor Chat History format and single-file context, and that the slug is derived once and reused for both context and plan filenames.
  • cli-js / cli-py symmetry: Same behavior for --slug and URL pre-fetch (url-fetch.ts vs url_fetch.py), including Notion skip and timeout/body limits.
  • Edge cases: Empty or invalid --slug; goal with no URLs; failed URL fetches (skip and continue).

Additional Info

  • Related Notion: context — Section 8 "Plan 모드 URL 선행 로딩 (설계 및 구현)" documents this feature.
  • Implements the "Plan URL pre-fetch flow" plan: URL content and chat summary in one context file, same filename slug as the plan file, and English-only skill copy.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@chucoding chucoding self-assigned this Mar 14, 2026
@chucoding
chucoding merged commit fe7f2a5 into develop Mar 14, 2026
1 check passed
@chucoding
chucoding deleted the feature/PF-10_chat branch March 14, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant