Build a Smart Regex Log Monitor with AI

Use ChatGPT's memory, AI-generated regex patterns, and GitHub MCP automation to build a personal log monitoring tool that learns your codebase over time.

What You'll Build

A Smart Regex Log Monitor — a personal tool that parses log files using AI-generated regular expressions, stores your preferences in ChatGPT's memory so it improves over time, and automatically pushes new regex rules and reports to a GitHub repository via MCP. This is a real developer workflow tool you'll actually use.

  • An HTML + JavaScript log file parser with a drag-and-drop input area
  • AI-generated regex rules for catching errors, warnings, and custom patterns
  • A rule library panel where you can save, label, and reload regex patterns
  • ChatGPT memory integration so the AI remembers your project's log format preferences
  • GitHub MCP automation that commits your regex rule library and match reports to a repo

What You'll Need

AI Tools

ChatGPT Plus (for Memory feature) and Claude or ChatGPT for code generation. You'll also need Claude with MCP configured for GitHub access.

Text Editor + GitHub Repo

VS Code or any editor to view your generated files. A GitHub account with a new empty repository where your regex rules and reports will be committed automatically.

Before You Start

This is an advanced project because it combines three separate AI workflows into one system. Don't worry — each step is self-contained, so you'll build confidence as you go. Make sure ChatGPT's Memory feature is turned on in your settings, and that you've connected Claude to GitHub via MCP (covered in the MCP + GitHub tutorial). Have a sample log file ready — even a few lines of fake server output like [ERROR] 2024-01-15 Connection timeout will work fine.

1

Step 1: Teach ChatGPT About Your Project with Memory

Before you write a single line of code, you're going to plant context into ChatGPT's long-term memory. This way, every time you come back to this project — today, next week, or next month — ChatGPT already knows your log format, your preferences, and what you're building. This is the foundation that makes the whole tool feel personalized.

ChatGPT Prompt — Memory Setup

I'm building a personal log monitoring tool called Smart Regex Log Monitor. Please remember these project details for all future conversations: - Project name: Smart Regex Log Monitor - My log format: lines start with [LEVEL] followed by a timestamp in YYYY-MM-DD format, then a message. Example: [ERROR] 2024-01-15 Connection timeout on port 8080 - I want regex patterns that capture: the severity level, the full timestamp, and the message body separately using named capture groups - My preferred programming language for this project: plain JavaScript (no frameworks) - My GitHub repo for this project: [PASTE YOUR REPO URL HERE] - I prefer regex patterns explained line-by-line, not just handed to me without explanation Confirm you've saved this and summarize what you now know about my project.

✅ What to look for

ChatGPT should confirm it's saved the memory and give you a summary that repeats your log format, named capture group preference, and repo URL back to you. You'll also see a small memory indicator appear in the chat UI. If it just answers without confirming memory, check that Memory is enabled in Settings → Personalization → Memory.

2

Step 2: Use AI to Generate and Understand Your Regex Rule Set

Now that ChatGPT knows your project, it's time to put that memory to work. You're going to ask it to generate a set of regex patterns tailored specifically to your log format — and crucially, explain each one so you actually understand what you've got. Regex you don't understand is a liability; regex you understand is a superpower.

ChatGPT Prompt — Regex Generation

Using the log format and preferences you have in memory for my Smart Regex Log Monitor project, please generate a JavaScript regex rule set as a JSON array. Each rule object should have these fields: { "id": "unique-slug", "label": "Human readable name", "regex": "the pattern as a string", "flags": "gi", "explanation": "plain English breakdown of each part of the pattern" } I need rules for: 1. Matching any ERROR level line and capturing the timestamp and message 2. Matching any WARNING level line and capturing the timestamp and message 3. Matching any line that contains an IP address (IPv4) 4. Matching any line that contains a port number (format: 'port XXXX') 5. A catch-all that matches any line with a recognized severity level After the JSON, walk me through rule #1 character by character so I understand exactly how the named capture groups work.

✅ What to look for

You should get a clean JSON array with 5 rule objects, each with all the required fields. The explanations should reference your specific log format (not a generic explanation). The character-by-character breakdown of rule #1 should identify the named capture groups like (?<level>ERROR) and explain why each part is written the way it is. Copy the entire JSON block — you'll use it in the next step.

3

Step 3: Build the Log Monitor HTML Tool

Time to build the actual interface. You'll paste your regex JSON from the last step directly into this prompt so the AI generates a tool that's pre-loaded with your real rules — not placeholder dummy data. This is a key habit: carry your real outputs from step to step so every piece connects.

ChatGPT or Claude Prompt — Build the Tool

Build me a single-file HTML tool called Smart Regex Log Monitor. Use plain JavaScript, no frameworks. Dark theme with a dark navy background (#0a0f1a), white/light text, and green (#22c55e) for match highlights. The tool must have: 1. A textarea where I can paste log content (labeled "Paste Log Content Here") 2. A "Run All Rules" button that applies every active regex rule to the log content 3. A results panel that shows each match with: the rule label that caught it, the full matched line, and the named capture group values displayed as key-value pairs 4. A sidebar "Rule Library" panel that lists all rules from this JSON array — [PASTE YOUR FULL JSON ARRAY FROM STEP 2 HERE] — each rule has a toggle checkbox to enable/disable it, shows its label and explanation text on hover/expand 5. A match summary bar at the top of results showing how many matches each rule found 6. A "Copy Report" button that copies a plain text summary of all matches to the clipboard The regex rules should be loaded from the JSON array hardcoded in a const at the top of the script. Add comments explaining each major section of code.

✅ What to look for

The AI should return a complete, self-contained HTML file. Save it as index.html and open it in your browser — it should work immediately without any setup. Test it by pasting a few fake log lines like [ERROR] 2024-01-15 Failed to connect on port 3000 and clicking Run All Rules. You should see highlighted matches and named capture group breakdowns appear in the results panel.

4

Step 4: Automate GitHub Commits with MCP

Here's where the three tutorials fully converge. You're going to use Claude with GitHub MCP to automatically commit your index.html and your regex rule library JSON into your GitHub repo — no manual git commands needed. This turns your local tool into a versioned, shareable project that you can update from a conversation.

Claude + GitHub MCP Prompt — First Commit

Using your GitHub MCP access, please do the following in my repository at [YOUR REPO URL]: 1. Create a file called `rules/core-rules.json` and populate it with this content: [PASTE YOUR REGEX JSON ARRAY FROM STEP 2] 2. Create a file called `index.html` and populate it with the full HTML tool we just built: [PASTE YOUR FULL index.html CONTENT] 3. Create a file called `README.md` with this content: # Smart Regex Log Monitor A personal log monitoring tool that uses AI-generated regex patterns to parse and highlight log files. ## Files - `index.html` — Open this in any browser to use the tool - `rules/core-rules.json` — The regex rule library powering the monitor ## How to Use 1. Open index.html in your browser 2. Paste log content into the textarea 3. Click Run All Rules to see matches Commit all three files with the message: "feat: initial Smart Regex Log Monitor with core rule library" Confirm each file was committed successfully and give me the direct GitHub URL for each file.

✅ What to look for

Claude should use its GitHub MCP connection to create all three files and return direct GitHub URLs for each one. Open those URLs in your browser to confirm the files are live in your repo. If Claude says it can't access GitHub, double-check your MCP configuration — the GitHub MCP server needs to be running and authenticated. The commit message should appear exactly as specified in your repo's commit history.

5

Step 5: Close the Loop — Update Memory and Add a New Rule

The final step proves the whole system works together. You're going to go back to ChatGPT, let it use its memory to suggest an improvement to your rule set, then push that update to GitHub via MCP — all from a conversation. This is the living workflow: memory → regex → code → GitHub, on repeat.

ChatGPT Prompt — Memory-Driven Rule Expansion

Based on everything you know about my Smart Regex Log Monitor project from memory, suggest one new regex rule I haven't added yet that would be genuinely useful for the log format I described. Format it as a single JSON object matching the same schema as my other rules (id, label, regex, flags, explanation). Then explain why you chose this particular rule — what gap does it fill based on what you know about my project? After that, also update your memory to add: "New rule added on [today's date]: [whatever rule label you suggest]" so we have a running changelog in your memory.

✅ What to look for

ChatGPT should reference your specific log format from memory when justifying its rule suggestion — not give a generic answer. The new rule JSON should match the exact same schema. It should also confirm it's updated its memory with the changelog note. Copy the new rule JSON object, then continue with the MCP commit below.

Claude + GitHub MCP Prompt — Push the Update

In my GitHub repository at [YOUR REPO URL], please update the file `rules/core-rules.json`. Fetch the current file content first, then append this new rule object to the end of the existing JSON array: [PASTE NEW RULE JSON FROM CHATGPT] Make sure the result is still valid JSON (properly comma-separated array). Commit the updated file with the message: "feat(rules): add [new rule label] pattern" Also update the README.md to add a "## Rule Changelog" section at the bottom listing today's date and the new rule label that was added. Confirm both files were updated and give me the commit URL.

✅ What to look for

Claude should fetch the existing core-rules.json, correctly merge in the new rule, and commit valid JSON. Check the GitHub commit URL it returns — you should see both files updated in the same commit. You now have a fully working, version-controlled, memory-aware log monitoring tool. This is the loop you'll run every time you want to add a new pattern.

Common Issues

⚠️ ChatGPT doesn't seem to remember my project

Go to Settings → Personalization → Manage Memories and confirm your project details are listed there. If they're missing, ChatGPT may have summarized them oddly or not saved them. Re-run Step 1's prompt and explicitly end it with "Please save this to your memory now." You can also manually add a memory via the Manage Memories interface.

⚠️ The regex rules don't match my log lines

Paste one of your actual log lines into ChatGPT and say: "This line isn't being matched by rule #1 — here's the exact line: [paste it]. Debug the regex and tell me what needs to change." AI is excellent at debugging regex interactively. Make sure your log lines match the format you described in Step 1 — even an extra space can break a pattern.

⚠️ Claude MCP can't find or update my GitHub repo

Make sure you're using the exact repo URL in the format https://github.com/username/repo-name. Also verify that the GitHub MCP server has write permissions — it needs a GitHub personal access token with repo scope. Re-check your MCP config file if Claude says it can't authenticate.

⚠️ The generated HTML doesn't work when I open it

Make sure you saved the file with a .html extension and are opening it directly in a browser (not a code editor preview). If the Rule Library panel is empty, the JSON array might have been truncated — ask the AI to "regenerate only the const rulesLibrary array" and replace just that section in your file.

What You Learned

Persistent AI Memory

You used ChatGPT's memory feature to store project-specific context that persisted across sessions, making every future interaction with the tool more targeted and accurate.

AI-Assisted Regex

You generated and understood named capture group regex patterns using AI — not just copying them blindly, but reading character-by-character explanations so you can modify them yourself.

MCP Workflow Automation

You used GitHub MCP to commit real files to a real repository through a conversation — no terminal, no git commands. You also learned how to fetch, merge, and re-commit existing files correctly.

Chaining AI Outputs Across Tools

You practiced carrying real outputs from one AI step into the next — JSON from ChatGPT into Claude, HTML from Claude into MCP — building a real pipeline rather than isolated one-off prompts.

Tips for Going Further

📊

Add a match frequency chart

Ask AI to add a simple bar chart to the results panel showing which rules fired most often. This turns your tool into a real log analytics dashboard that reveals patterns in your system's behavior over time.

🔄

Build a GitHub Actions workflow

Ask Claude via MCP to create a .github/workflows/ YAML that automatically validates your core-rules.json is valid JSON every time you push — your first real CI pipeline.

🧠

Expand ChatGPT's memory with real sessions

After using the tool on real logs, come back to ChatGPT and say "We found 47 port errors in today's run — remember this as a baseline for my project." Build a true long-term log of your system's health inside the memory feature.

📁

Support multiple rule library files

Create separate rule sets for different projects — rules/nginx-rules.json, rules/node-rules.json — and ask AI to add a dropdown to the tool that lets you switch between them. Use MCP to commit each new rule set as its own file.

More projects

One of 34 hands-on projects.

All projects Getting Started tutorials