Skip to content

026.07 Agent Open/Close

Description

As an AI Agent, I want to open and close QualCoder projects so that I can autonomously manage the project lifecycle during automated workflows (e.g., batch analysis, CI pipelines, headless operation).

Currently the agent can query project context (get_project_context) and navigate within an open project, but cannot open or close projects programmatically. This blocks headless/automated agent workflows.

Trust Level: T2 (Notify) — Agent acts, researcher informed post-action. Opening/closing projects is a safe, reversible operation. The researcher is notified but no approval is required.

Bounded Context: Projects Layer: Interface (MCP tools)

Acceptance Criteria

  • [x] #1 MCP tool open_project is registered with path as required parameter
  • [x] #2 Agent can open a .qda project file by providing its absolute path
  • [x] #3 Invalid or non-existent paths return clear failure messages matching ProjectNotOpened failure events
  • [x] #4 ProjectOpened domain event is published on success
  • [x] #5 MCP tool close_project is registered (no parameters required)
  • [x] #6 Agent can close the currently open project
  • [x] #7 Closing when no project is open returns an informative message (not an error)
  • [x] #8 ProjectClosed domain event is published on close
  • [x] #9 E2E test exists with @allure.story("QC-026.07 Agent Open/Close Project") decorator

Notes

  • When opening a project, any currently open project is closed first (matching UI behavior)
  • The close_project tool is idempotent — calling it with no project open is safe