We need to take a new approach to the 2nd brain project. Review the approach and confirm your agreement that it is the best approach:
- Provide a simple, useful tool to capture and process requests to my 2nd brain application.
- The front-end architecture should be simple.
- It should be easy to extend with future tools and features.
- Do not overcomplicate the architecture.
- Do not implement APEX App features, instead provide details on how to implement them.
- Keep JavaScript to a minimum.
- A single submission entry field is pinned to the bottom of the page, where the user can enter instructions for the 2nd brain.
- Simple Submit button that submits the question for processing.
- The submission to the back end is handled via a simple Dynamic action that calls PL/SQL.
- After submission, a styled spinner should be displayed to block further activity until the AI's turn is complete.
- All submissions should be synchronous.
- The submission is added to a queue table, and then processing begins.
- The queue table should be designed to allow external entities to post requests.
- Processing should be controlled by an agentic loop.
- Use the config_code
SB_PROCESS_USER_MESSAGEas the main 'brain' for the loop. - When the 2nd brain needs clarification, finish the turn, give control back to the user, and allow them to enter the clarification in the submission entry field.
- When the 2nd brain wants to perform a write action (e.g., add_calendar_entry), finish the turn, return control to the user, and allow them to confirm the action by typing in the submission field.
- The table
GEN_AI_CONFIGScontains AI configurations, including the Provider API URL, reasoning effort, verbocity. - The table
GEN_AI_TOOLSlists tools. - The table
GEN_AI_TOOL_PARAMSlists the parameters for the tools. - The table
GEN_AI_CONFIG_TOOLSlists configuration-specific tools. - Use the config_code
SB_PROCESS_USER_MESSAGE_DOITas the main 'brain' for the loop. - Suggest any other configs you may need, e.g., a configuration and instructions for handling clarifications.
- Include the AI Config tools with each request.
- When appropriate, add the OpenAI web search tool (even if not in the AI Config).
- Initially, the following tools will be available. You need to build functions and dispatcher logic for each of them:
- get_calendar_entries - read only
- get_emails - read only
- get_sb_entries - read only
- add_calendar_entry - write directly using Google Calendar API
- add_sb_entry - write a record to the table
sb_entries
- All get tools should return a JSON Object.
- When a tool request requires a write action (add_calendar_entry, add_sb_entry), finish the turn and obtain user confirmation before continuing.
- You can delete the existing data model and start again if it is easier.
- Feel free to take ideas from other packages in the repo, but you should create all new packages, tables, and views.
- New DB objects should be prefixed SB_REQUEST_*
- Prefer PL/SQL over JavaScript unless necessary.