Skip to content

Implement Project Homepage, BRAIN, and polished context UX - #4

Merged
DaveHomeAssist merged 1 commit into
mainfrom
feat/project-context-homepage
Aug 26, 2026
Merged

DaveHomeAssist merged 1 commit into
mainfrom
feat/project-context-homepage

Conversation

@DaveHomeAssist

Copy link
Copy Markdown
Owner

What changed

  • implement normalized Project Homepage storage for instructions, file context, artifact history, and BRAIN
  • add bounded context assembly, unused-token rollover, exact no-send preview, explicit chat attachment, and authenticated BRAIN CLI
  • vendor Lucide composer icons and reduced-motion-safe GSAP choreography with local license notices
  • document the completed P0-P8 ledger and runtime contracts

Verification

  • 52 pytest tests passed
  • Python and JavaScript syntax checks passed
  • npm dependency tree clean; npm audit reports 0 vulnerabilities
  • desktop and mobile browser workflows verified with no new console warnings or errors
  • CLI show, pin, compact, revisions, restore, and delete verified against a fresh local router

Boundaries

  • no live Ollama inference was claimed because the verification router intentionally had no configured nodes
  • known FastAPI on_event and Starlette TestClient deprecation warnings remain unchanged

@DaveHomeAssist
DaveHomeAssist merged commit 85c9baa into main Aug 26, 2026
1 check passed
@DaveHomeAssist
DaveHomeAssist deleted the feat/project-context-homepage branch August 26, 2026 09:17

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 53015bf8ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread app.py
Comment on lines +1936 to +1941
PROJECT_CONTEXT.add_artifact(
project_id,
title=conversation.get("title") or "Assistant output",
body=message["content"],
conversation_id=conversation_id,
source_message_index=index,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve artifact deletions during backfill

After an artifact backed by a conversation message is deleted, the Project Homepage immediately calls backfill_project_artifacts, and this unconditional add_artifact recreates it because the original assistant message still exists. Consequently, the UI's delete operation appears to succeed but the artifact returns on the ensuing refresh; persist a deletion tombstone or make backfill distinguish intentionally deleted sources.

Useful? React with 👍 / 👎.

Comment thread project_context.py
Comment on lines +903 to +908
connection.execute(
"""
INSERT OR IGNORE INTO project_artifacts
(artifact_id, project_id, conversation_id, source_message_index,
title, kind, body, token_count, pinned, archived, created_at, updated_at)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?, ?)

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 Badge Avoid identifying artifacts by reusable message indexes

When an attached conversation is cleared through /conversations/{id}/clear, its message indexes restart from zero while its existing artifacts remain. A subsequent assistant response can therefore reuse an old (project_id, conversation_id, source_message_index) key; this INSERT OR IGNORE silently keeps the old artifact and drops the new response from artifact history. Use a stable per-message identifier or retire the old source keys when clearing a conversation.

Useful? React with 👍 / 👎.

Comment thread app.py
Comment on lines +1618 to +1619
project_instruction_tokens = estimate_project_tokens(project.get("system_prompt") or "")
non_project_tokens = max(0, base_tokens - project_instruction_tokens)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reserve legacy replacement prompts in the context budget

For an upgraded conversation in legacy instruction_mode == "replace", the effective system_prompt does not contain the project's instructions, but these lines still subtract their token count from base_tokens. With large project instructions, this can erase the accounting for the replacement prompt and conversation history, over-allocate project context, and send a payload beyond the selected model's context window. Only subtract project-instruction tokens when that text is actually present in the effective system message.

Useful? React with 👍 / 👎.

Comment thread app.py
preferred_node: Optional[str] = None
max_budget: Optional[float] = None
description: Optional[str] = None
context_budget_tokens: Optional[int] = Field(default=16_384, ge=1_024, le=262_144)

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 Badge Honor the configured default project context budget

When DAVE_PROJECT_CONTEXT_TOKENS is set, newly created projects still receive 16,384 tokens because ProjectCreate supplies this literal default, so create_project never falls back to PROJECT_CONTEXT.default_context_budget. Operators configuring a smaller or larger default therefore see no effect for normal API/UI-created projects; derive this field's creation default from the configured value instead.

Useful? React with 👍 / 👎.

Comment thread project_context.py
Comment on lines +581 to +587
connection.execute(
"""
UPDATE brain_states
SET pinned_text = ?, active_text = ?, recent_text = ?, compact_threshold = ?,
token_count = ?, revision = ?, updated_at = ?, last_compacted_at = ?,
deleted_at = NULL
WHERE project_id = ?

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 Badge Validate restored BRAIN revisions against the current budget

If a project once had a large BRAIN revision, then its active BRAIN is reduced and its project budget is lowered, restoring the older revision copies its protected text and compaction threshold back without checking the current allocation. The restore reports success, but subsequent context previews and chats can fail with ContextBudgetError until the BRAIN is edited again. Apply the same protected-content and threshold checks used by BRAIN/profile updates before committing a restore.

Useful? React with 👍 / 👎.

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.

1 participant